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
9c2d41bfa71743ecdacda0be2a80e33d03413d34
Add feature list
mattgwagner/alert-roster
alert-roster.web/Views/Home/About.cshtml
alert-roster.web/Views/Home/About.cshtml
@{ ViewBag.Title = "About"; } <h2>@ViewBag.Title</h2> <p>This is a small, stand-alone web application written to solve a simple need -- easily posting notices for a group to reference.</p> <p>It's meant to be straight-forward and mobile phone accessible.</p> <p>Possible future features might be E-mail or SMS notifications to subscribed users.</p> <p>You can find the source code at <a href="http://github.com/mattgwagner/alert-roster">GitHub</a>.</p>
@{ ViewBag.Title = "About"; } <h2>@ViewBag.Title</h2> <p>This is a small, stand-alone web application written to solve a simple need -- easily posting notices for a group to reference.</p> <p>It's meant to be straight-forward, and mobile phone accessible.</p> <p>You can find the source code at <a href="http://github.com/mattgwagner/alert-roster">GitHub</a>.</p>
mit
C#
673b6d67334aeca7bba13f78d1e49e35a576d180
Fix login partial name
btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver
BTCPayServer/Views/Account/SecondaryLogin.cshtml
BTCPayServer/Views/Account/SecondaryLogin.cshtml
@model SecondaryLoginViewModel @{ ViewData["Title"] = "Two-factor/U2F authentication"; } <section> <div class="container"> @if (Model.LoginWith2FaViewModel != null && Model.LoginWithFido2ViewModel != null) { <div asp-validation-summary="ModelOnly" class="text-danger"></div> } else if (Model.LoginWith2FaViewModel == null && Model.LoginWithFido2ViewModel == null) { <div class="row"> <div class="col-lg-12 section-heading"> <h2 class="bg-danger">Both 2FA and U2F/FIDO2 Authentication Methods are not available. Please go to the https endpoint.</h2> <hr class="danger"> </div> </div> } <div class="row justify-content-center"> @if (Model.LoginWith2FaViewModel != null) { <div class="col-sm-12 col-md-6"> <partial name="LoginWith2fa" model="@Model.LoginWith2FaViewModel"/> </div> } @if (Model.LoginWithFido2ViewModel != null) { <div class="col-sm-12 col-md-6"> <partial name="LoginWithFido2" model="@Model.LoginWithFido2ViewModel"/> </div> } </div> </div> </section> @section PageFootContent { <partial name="_ValidationScriptsPartial" /> }
@model SecondaryLoginViewModel @{ ViewData["Title"] = "Two-factor/U2F authentication"; } <section> <div class="container"> @if (Model.LoginWith2FaViewModel != null && Model.LoginWithFido2ViewModel != null) { <div asp-validation-summary="ModelOnly" class="text-danger"></div> } else if (Model.LoginWith2FaViewModel == null && Model.LoginWithFido2ViewModel == null) { <div class="row"> <div class="col-lg-12 section-heading"> <h2 class="bg-danger">Both 2FA and U2F/FIDO2 Authentication Methods are not available. Please go to the https endpoint.</h2> <hr class="danger"> </div> </div> } <div class="row justify-content-center"> @if (Model.LoginWith2FaViewModel != null) { <div class="col-sm-12 col-md-6"> <partial name="Loginwith2fa" model="@Model.LoginWith2FaViewModel"/> </div> } @if (Model.LoginWithFido2ViewModel != null) { <div class="col-sm-12 col-md-6"> <partial name="LoginWithFido2" model="@Model.LoginWithFido2ViewModel"/> </div> } </div> </div> </section> @section PageFootContent { <partial name="_ValidationScriptsPartial" /> }
mit
C#
706bcc885837cd255d6fb3e0030ebab8c171245f
Update cache version
JetBrains/resharper-unity,JetBrains/resharper-unity,JetBrains/resharper-unity
resharper/resharper-unity/src/CacheVersion.cs
resharper/resharper-unity/src/CacheVersion.cs
using JetBrains.Annotations; using JetBrains.Application.PersistentMap; using JetBrains.Serialization; namespace JetBrains.ReSharper.Plugins.Unity { // Cache version [PolymorphicMarshaller(3)] public class CacheVersion { [UsedImplicitly] public static UnsafeReader.ReadDelegate<object> ReadDelegate = r => new CacheVersion(); [UsedImplicitly] public static UnsafeWriter.WriteDelegate<object> WriteDelegate = (w, o) => { }; } }
using JetBrains.Annotations; using JetBrains.Application.PersistentMap; using JetBrains.Serialization; namespace JetBrains.ReSharper.Plugins.Unity { // Cache version [PolymorphicMarshaller(2)] public class CacheVersion { [UsedImplicitly] public static UnsafeReader.ReadDelegate<object> ReadDelegate = r => new CacheVersion(); [UsedImplicitly] public static UnsafeWriter.WriteDelegate<object> WriteDelegate = (w, o) => { }; } }
apache-2.0
C#
128b9f19c06c88093a46ed597daba9a3ebaab646
Make configuration private
serbrech/Common.Serializer
src/Common.Serializer/Serialization.cs
src/Common.Serializer/Serialization.cs
using System; using Common.Serializer.Xml; namespace Common.Serializer { public class Serialization { private static readonly SerializationConfiguration Configuration; private static readonly Lazy<ISerializationContext> SerializationContext = new Lazy<ISerializationContext>(() => new SerializationContext(Configuration)); public static ISerializationContext With { get { return SerializationContext.Value; } } static Serialization() { Configuration = new SerializationConfiguration { DefaultAdapter = new XmlSerializerAdapter() }; } public static string Serialize<T>(T obj) { return With.Default().Serialize(obj); } public static T Deserialize<T>(string serializedObj) where T : new() { return With.Default().Deserialize<T>(serializedObj); } public static void Initialize(Action<SerializationConfiguration> configure) { configure(Configuration); } } }
using System; using Common.Serializer.Xml; namespace Common.Serializer { public class Serialization { public static SerializationConfiguration Configuration { get; internal set; } private static readonly Lazy<ISerializationContext> SerializationContext = new Lazy<ISerializationContext>(() => new SerializationContext(Configuration)); public static ISerializationContext With { get { return SerializationContext.Value; } } private Serialization() { Configuration = Configuration; } static Serialization() { Configuration = new SerializationConfiguration { DefaultAdapter = new XmlSerializerAdapter() }; } public static string Serialize<T>(T obj) { return With.Default().Serialize(obj); } public static T Deserialize<T>(string serializedObj) where T : new() { return With.Default().Deserialize<T>(serializedObj); } public static void Initialize(Action<SerializationConfiguration> configure) { configure(Configuration); } } }
mit
C#
3462e8b9fbc19b04df357b18958952f7fde4d417
Test for missing header property.
ar3cka/Journalist
test/Journalist.EventStore.UnitTests/Events/JournaledEventTests.cs
test/Journalist.EventStore.UnitTests/Events/JournaledEventTests.cs
using System.IO; using Journalist.EventStore.Events; using Journalist.EventStore.UnitTests.Infrastructure.TestData; using Xunit; namespace Journalist.EventStore.UnitTests.Events { public class JournaledEventTests { [Theory] [AutoMoqData] public void GetEventPayload_ReturnsStreamWithPayloadContent(string payload) { var journaledEvent = JournaledEvent.Create(new object(), (evt, type, writer) => writer.Write(payload)); using (var payloadStream = journaledEvent.GetEventPayload()) using (var reader = new StreamReader(payloadStream)) { Assert.Equal(payload, reader.ReadToEnd()); } } [Theory] [AutoMoqData] public void RestoredEvent_ShouldRestoreHeaders(string payload) { var journaledEvent = JournaledEvent.Create(new object(), (evt, type, writer) => writer.Write(payload)); journaledEvent.SetHeader("A", "A"); journaledEvent.SetHeader("B", "B"); var eventProperties = journaledEvent.ToDictionary(); var restoredEvent = JournaledEvent.Create(eventProperties); Assert.Equal("A", restoredEvent.Headers["A"]); Assert.Equal("B", restoredEvent.Headers["B"]); } [Theory] [AutoMoqData] public void GetEventPayload_ForRestoredEvents_ReturnsStreamWithPayloadContent(string payload) { var journaledEvent = JournaledEvent.Create(new object(), (evt, type, writer) => writer.Write(payload)); var eventProperties = journaledEvent.ToDictionary(); var restoredEvent = JournaledEvent.Create(eventProperties); using (var payloadStream = restoredEvent.GetEventPayload()) using (var reader = new StreamReader(payloadStream)) { Assert.Equal(payload, reader.ReadToEnd()); } } [Theory] [AutoMoqData] public void GetEventPayload_ForRestoredEventsWithoutHeaderProperty_ReturnsStreamWithPayloadContent(string payload) { var journaledEvent = JournaledEvent.Create(new object(), (evt, type, writer) => writer.Write(payload)); var eventProperties = journaledEvent.ToDictionary(); eventProperties.Remove(JournaledEventPropertyNames.EventHeaders); var restoredEvent = JournaledEvent.Create(eventProperties); using (var payloadStream = restoredEvent.GetEventPayload()) using (var reader = new StreamReader(payloadStream)) { Assert.Equal(payload, reader.ReadToEnd()); } } } }
using System.IO; using Journalist.EventStore.Events; using Journalist.EventStore.UnitTests.Infrastructure.TestData; using Xunit; namespace Journalist.EventStore.UnitTests.Events { public class JournaledEventTests { [Theory] [AutoMoqData] public void GetEventPayload_ReturnsStreamWithPayloadContent(string payload) { var journaledEvent = JournaledEvent.Create(new object(), (evt, type, writer) => writer.Write(payload)); using (var payloadStream = journaledEvent.GetEventPayload()) using (var reader = new StreamReader(payloadStream)) { Assert.Equal(payload, reader.ReadToEnd()); } } [Theory] [AutoMoqData] public void RestoredEvent_ShouldRestoreHeaders(string payload) { var journaledEvent = JournaledEvent.Create(new object(), (evt, type, writer) => writer.Write(payload)); journaledEvent.SetHeader("A", "A"); journaledEvent.SetHeader("B", "B"); var eventProperties = journaledEvent.ToDictionary(); var restoredEvent = JournaledEvent.Create(eventProperties); Assert.Equal("A", restoredEvent.Headers["A"]); Assert.Equal("B", restoredEvent.Headers["B"]); } [Theory] [AutoMoqData] public void GetEventPayload_ForRestoredEvents_ReturnsStreamWithPayloadContent(string payload) { var journaledEvent = JournaledEvent.Create(new object(), (evt, type, writer) => writer.Write(payload)); var eventProperties = journaledEvent.ToDictionary(); var restoredEvent = JournaledEvent.Create(eventProperties); using (var payloadStream = restoredEvent.GetEventPayload()) using (var reader = new StreamReader(payloadStream)) { Assert.Equal(payload, reader.ReadToEnd()); } } } }
apache-2.0
C#
efb59091ed0aa5f9a305e74149767e795a7e5337
Set HasFile when opening an image from the command line, so we won't use Save As when Save is clicked.
PintaProject/Pinta,Mailaender/Pinta,PintaProject/Pinta,jakeclawson/Pinta,Fenex/Pinta,Mailaender/Pinta,jakeclawson/Pinta,Fenex/Pinta,PintaProject/Pinta
Pinta/Main.cs
Pinta/Main.cs
// // Main.cs // // Author: // Jonathan Pobst <monkey@jpobst.com> // // Copyright (c) 2010 Jonathan Pobst // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using Gtk; using Mono.Options; using System.Collections.Generic; using Pinta.Core; namespace Pinta { class MainClass { public static void Main (string[] args) { int threads = -1; var p = new OptionSet () { { "rt|render-threads=", "number of threads to use for rendering", (int v) => threads = v } }; List<string> extra; try { extra = p.Parse (args); } catch (OptionException e) { Console.Write ("Pinta: "); Console.WriteLine (e.Message); return; } Application.Init (); MainWindow win = new MainWindow (); win.Show (); if (threads != -1) Pinta.Core.PintaCore.System.RenderThreads = threads; if (extra.Count > 0) { // Not sure what this does for Mac, so I'm not touching it if (Platform.GetOS () == Platform.OS.Mac) { string arg = args[0]; if (args[0].StartsWith ("-psn_")) { if (args.Length > 1) arg = args[1]; else arg = null; } if (!string.IsNullOrEmpty (arg)) { Pinta.Core.PintaCore.Actions.File.OpenFile (arg); PintaCore.Workspace.ActiveDocument.HasFile = true; } } else { Pinta.Core.PintaCore.Actions.File.OpenFile (extra[0]); PintaCore.Workspace.ActiveDocument.HasFile = true; } } Application.Run (); } } }
// // Main.cs // // Author: // Jonathan Pobst <monkey@jpobst.com> // // Copyright (c) 2010 Jonathan Pobst // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using Gtk; using Mono.Options; using System.Collections.Generic; namespace Pinta { class MainClass { public static void Main (string[] args) { int threads = -1; var p = new OptionSet () { { "rt|render-threads=", "number of threads to use for rendering", (int v) => threads = v } }; List<string> extra; try { extra = p.Parse (args); } catch (OptionException e) { Console.Write ("Pinta: "); Console.WriteLine (e.Message); return; } Application.Init (); MainWindow win = new MainWindow (); win.Show (); if (threads != -1) Pinta.Core.PintaCore.System.RenderThreads = threads; if (extra.Count > 0) { // Not sure what this does for Mac, so I'm not touching it if (Platform.GetOS () == Platform.OS.Mac) { string arg = args[0]; if (args[0].StartsWith ("-psn_")) { if (args.Length > 1) arg = args[1]; else arg = null; } if (arg != null && arg != "") Pinta.Core.PintaCore.Actions.File.OpenFile (arg); } else { Pinta.Core.PintaCore.Actions.File.OpenFile (extra[0]); } } Application.Run (); } } }
mit
C#
9c5695401c2cf6e7b751f0c108793f4435d2cf55
Update ChangeHtmlLinkTarget.cs
aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,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,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET
Examples/CSharp/Articles/ChangeHtmlLinkTarget.cs
Examples/CSharp/Articles/ChangeHtmlLinkTarget.cs
using System; using Aspose.Cells; namespace CSharp.Articles { class ChangeHtmlLinkTarget { public static void Main(string[] args) { //ExStart:1 // The path to the documents directory. string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); string inputPath = dataDir + "Sample1.xlsx"; string outputPath = dataDir + "Output.out.html"; Workbook workbook = new Workbook(dataDir + "Sample1.xlsx"); HtmlSaveOptions opts = new HtmlSaveOptions(); opts.LinkTargetType = HtmlLinkTargetType.Self; workbook.Save(outputPath, opts); Console.WriteLine("File saved: {0}", outputPath); //ExEnd:1 } } }
using System; using Aspose.Cells; namespace CSharp.Articles { class ChangeHtmlLinkTarget { public static void Main(string[] args) { // The path to the documents directory. string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); string inputPath = dataDir + "Sample1.xlsx"; string outputPath = dataDir + "Output.out.html"; Workbook workbook = new Workbook(dataDir + "Sample1.xlsx"); HtmlSaveOptions opts = new HtmlSaveOptions(); opts.LinkTargetType = HtmlLinkTargetType.Self; workbook.Save(outputPath, opts); Console.WriteLine("File saved: {0}", outputPath); } } }
mit
C#
6152ca9c6d5d40a0dca4b0f450b8659805457c75
Fix for #2547 occasional null HttpContext on Mono (#2556)
shibayan/kudu,projectkudu/kudu,projectkudu/kudu,shibayan/kudu,EricSten-MSFT/kudu,shibayan/kudu,projectkudu/kudu,shibayan/kudu,EricSten-MSFT/kudu,EricSten-MSFT/kudu,EricSten-MSFT/kudu,projectkudu/kudu,shibayan/kudu,EricSten-MSFT/kudu,projectkudu/kudu
Kudu.Services/EnsureRequestIdHandlerAttribute.cs
Kudu.Services/EnsureRequestIdHandlerAttribute.cs
using System; using System.Collections.Generic; using System.Web; using System.Web.Http.Filters; namespace Kudu.Services { [AttributeUsage(AttributeTargets.Class)] public sealed class EnsureRequestIdHandlerAttribute : ActionFilterAttribute { public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext) { // https://github.com/projectkudu/kudu/issues/2547 // On Mono, some async method calls may cause loss of context. // (A confirmed repro is the call to searchResource.Search in FeedExtensions.Search). // For now, just skip setting the response header if that's the case. var currentContext = HttpContext.Current; if (currentContext == null) { return; } IEnumerable<string> requestIds; if (actionExecutedContext.Request.Headers.TryGetValues(Constants.ArrLogIdHeader, out requestIds) || actionExecutedContext.Request.Headers.TryGetValues(Constants.RequestIdHeader, out requestIds)) { foreach (var rid in requestIds) { // do not use Response from actionExecutedContext, if exception is throw, response will be null currentContext.Response.AddHeader(Constants.RequestIdHeader, rid); } } else { string newRequestId = Guid.NewGuid().ToString(); currentContext.Response.AddHeader(Constants.RequestIdHeader, newRequestId); } } } }
using System; using System.Collections.Generic; using System.Web; using System.Web.Http.Filters; namespace Kudu.Services { [AttributeUsage(AttributeTargets.Class)] public sealed class EnsureRequestIdHandlerAttribute : ActionFilterAttribute { public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext) { IEnumerable<string> requestIds; if (actionExecutedContext.Request.Headers.TryGetValues(Constants.ArrLogIdHeader, out requestIds) || actionExecutedContext.Request.Headers.TryGetValues(Constants.RequestIdHeader, out requestIds)) { foreach (var rid in requestIds) { // do not use Response from actionExecutedContext, if exception is throw, response will be null HttpContext.Current.Response.AddHeader(Constants.RequestIdHeader, rid); } } else { string newRequestId = Guid.NewGuid().ToString(); HttpContext.Current.Response.AddHeader(Constants.RequestIdHeader, newRequestId); } } } }
apache-2.0
C#
bfe1184d2f3fad93dec65fe82534a083bfbb6a19
hide ios keyboard after add
harouny/XamarinTodoList
TodoList/TodoList.iOS/ViewController.cs
TodoList/TodoList.iOS/ViewController.cs
using System; using System.IO; using System.Threading.Tasks; using TodoList.Models; using UIKit; namespace TodoList.iOS { public partial class ViewController : UIViewController { private ITodosService _todosService; public ViewController (IntPtr handle) : base (handle) { UITableView.Appearance.TintColor = UIColor.FromRGB(0x6F, 0xA2, 0x2E); } public override async void ViewDidLoad () { base.ViewDidLoad (); if (_todosService == null) { // Create the database file var sqliteFilename = "TodoItemDB.db3"; // we need to put in /Library/ on iOS5.1 to meet Apple's iCloud terms // (they don't want non-user-generated data in Documents) string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); // Documents folder string libraryPath = Path.Combine(documentsPath, "..", "Library"); // Library folder var path = Path.Combine(libraryPath, sqliteFilename); _todosService = new TodosService(path); } await PopulateTable(); } protected async Task PopulateTable() { TodoTableView.Source = new TodoTableViewSource(await _todosService.GetTodoItemsAsync(), _todosService); } // ReSharper disable once UnusedMember.Local // ReSharper disable once UnusedParameter.Local async partial void AddBtn_TouchUpInside(UIButton sender) { var todoItem = new TodoItem { Name = TodoText.Text }; TodoText.Text = string.Empty; await _todosService.AddTodoItemAsync(todoItem); TodoText.ResignFirstResponder(); TodoTableView.ReloadData(); } } }
using System; using System.IO; using System.Threading.Tasks; using TodoList.Models; using UIKit; namespace TodoList.iOS { public partial class ViewController : UIViewController { private ITodosService _todosService; public ViewController (IntPtr handle) : base (handle) { UITableView.Appearance.TintColor = UIColor.FromRGB(0x6F, 0xA2, 0x2E); } public override async void ViewDidLoad () { base.ViewDidLoad (); if (_todosService == null) { // Create the database file var sqliteFilename = "TodoItemDB.db3"; // we need to put in /Library/ on iOS5.1 to meet Apple's iCloud terms // (they don't want non-user-generated data in Documents) string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); // Documents folder string libraryPath = Path.Combine(documentsPath, "..", "Library"); // Library folder var path = Path.Combine(libraryPath, sqliteFilename); _todosService = new TodosService(path); } await PopulateTable(); } protected async Task PopulateTable() { TodoTableView.Source = new TodoTableViewSource(await _todosService.GetTodoItemsAsync(), _todosService); } // ReSharper disable once UnusedMember.Local // ReSharper disable once UnusedParameter.Local async partial void AddBtn_TouchUpInside(UIButton sender) { var todoItem = new TodoItem { Name = TodoText.Text }; TodoText.Text = string.Empty; await _todosService.AddTodoItemAsync(todoItem); TodoTableView.ReloadData(); } } }
apache-2.0
C#
4583683d8b2b7c539d5ebf007387d79a379030f5
Modify error handling for SendInput
hukatama024e/MacroRecoderCsScript,hukatama024e/UserInputMacro
src/UserInputMacro/SendInputWrapper.cs
src/UserInputMacro/SendInputWrapper.cs
using System.Runtime.InteropServices; using System.ComponentModel; using System.Windows.Input; namespace UserInputMacro { public static class SendInputWrapper { private static readonly int FAIL_SENDINPUT = 0; [ DllImport( "user32.dll", SetLastError = true ) ] private static extern uint SendInput( uint inputNum, Input[] inputs, int inputStructSize ); public static void PressKey( Key key ) { KeyInput[] keyInput = new KeyInput[ 1 ]; keyInput[ 0 ] = new KeyInput { virtualKey = ( ushort ) KeyInterop.VirtualKeyFromKey( key ) }; SendKeyInput( keyInput ); } public static void SendMouseInput( MouseInput[] mouseInput ) { uint result; Input[] input = new Input[ mouseInput.Length ]; for( int i = 0; i < mouseInput.Length; i++ ) { input[ i ].type = InputType.Mouse; input[ i ].inputInfo.mouseInput = mouseInput[ i ]; } result = SendInput( ( uint ) input.Length, input, Marshal.SizeOf( input[ 0 ] ) ); if( result == FAIL_SENDINPUT ) { int errorCode = Marshal.GetLastWin32Error(); throw new Win32Exception( errorCode ); } } public static void SendKeyInput( KeyInput[] keyInput ) { uint result; Input[] input = new Input[ keyInput.Length ]; for( int i = 0; i < keyInput.Length; i++ ) { input[ i ].type = InputType.Keyboard; input[ i ].inputInfo.keyInput = keyInput[ i ]; } result = SendInput( ( uint ) input.Length, input, Marshal.SizeOf( input[ 0 ] ) ); if( result == FAIL_SENDINPUT ) { int errorCode = Marshal.GetLastWin32Error(); throw new Win32Exception( errorCode ); } } } }
using System.Runtime.InteropServices; using System.ComponentModel; using System.Windows.Input; namespace UserInputMacro { public static class SendInputWrapper { private static readonly int WIN32_NOERROR = 0x00000000; [ DllImport( "user32.dll", SetLastError = true ) ] private static extern uint SendInput( uint inputNum, Input[] inputs, int inputStructSize ); public static void PressKey( Key key ) { KeyInput[] keyInput = new KeyInput[ 1 ]; keyInput[ 0 ] = new KeyInput { virtualKey = ( ushort ) KeyInterop.VirtualKeyFromKey( key ) }; SendKeyInput( keyInput ); } public static void SendMouseInput( MouseInput[] mouseInput ) { Input[] input = new Input[ mouseInput.Length ]; for( int i = 0; i < mouseInput.Length; i++ ) { input[ i ].type = InputType.Mouse; input[ i ].inputInfo.mouseInput = mouseInput[ i ]; } SendInput( ( uint ) input.Length, input, Marshal.SizeOf( input[ 0 ] ) ); int errorCode = Marshal.GetLastWin32Error(); if( errorCode != WIN32_NOERROR ) { throw new Win32Exception( errorCode ); } } public static void SendKeyInput( KeyInput[] keyInput ) { Input[] input = new Input[ keyInput.Length ]; for( int i = 0; i < keyInput.Length; i++ ) { input[ i ].type = InputType.Keyboard; input[ i ].inputInfo.keyInput = keyInput[ i ]; } SendInput( ( uint ) input.Length, input, Marshal.SizeOf( input[ 0 ] ) ); int errorCode = Marshal.GetLastWin32Error(); if( errorCode != WIN32_NOERROR ) { throw new Win32Exception( errorCode ); } } } }
mit
C#
7fac30425055eab5d2be23c23a451c3641345098
Fix stats link so that it doesn't have the id in it.
chrisofspades/PickemApp,chrisofspades/PickemApp,chrisofspades/PickemApp
PickemApp/Views/Home/NavLogin.cshtml
PickemApp/Views/Home/NavLogin.cshtml
@model PickemApp.ViewModels.HomeNavLogin @{ Layout = null; } <ul class="nav navbar-nav navbar-right"> @if (Request.IsAuthenticated) { <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">@Model.CurrentPlayer.Name <span class="caret"></span></a> <ul class="dropdown-menu"> <li><a href="@Url.Action("Index", "Profile")">Profile</a></li> <li><a href="@Url.Action("Stats", "Profile", new { id = string.Empty })">Stats</a></li> <li><a href="@Url.Action("Index", "Picks")">Picks</a></li> @if (User.IsInRole("admin")) { <li role="separator" class="divider"></li> <li class="dropdown-header">Admin</li> <li><a href="@Url.Action("Picks", "Sync")">Upload Picks</a></li> <li><a href="#">Players</a></li> } <li role="separator" class="divider"></li> <li> <a href="javascript:document.getElementById('logoutForm').submit()">Log off</a> @using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm" })) { @Html.AntiForgeryToken() } </li> </ul> </li> } else { <li><a href="@Url.Action("Login", "Account")">Login</a></li> } </ul>
@model PickemApp.ViewModels.HomeNavLogin @{ Layout = null; } <ul class="nav navbar-nav navbar-right"> @if (Request.IsAuthenticated) { <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">@Model.CurrentPlayer.Name <span class="caret"></span></a> <ul class="dropdown-menu"> <li><a href="@Url.Action("Index", "Profile")">Profile</a></li> <li><a href="@Url.Action("Stats", "Profile")">Stats</a></li> <li><a href="@Url.Action("Index", "Picks")">Picks</a></li> @if (User.IsInRole("admin")) { <li role="separator" class="divider"></li> <li class="dropdown-header">Admin</li> <li><a href="@Url.Action("Picks", "Sync")">Upload Picks</a></li> <li><a href="#">Players</a></li> } <li role="separator" class="divider"></li> <li> <a href="javascript:document.getElementById('logoutForm').submit()">Log off</a> @using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm" })) { @Html.AntiForgeryToken() } </li> </ul> </li> } else { <li><a href="@Url.Action("Login", "Account")">Login</a></li> } </ul>
isc
C#
8edad8a648fa8aaa4184b31c54aa6a592d0f60a0
Use static form style
mgmccarthy/allReady,jonatwabash/allReady,jonatwabash/allReady,chinwobble/allReady,BillWagner/allReady,mipre100/allReady,mikesigs/allReady,arst/allReady,chinwobble/allReady,bcbeatty/allReady,joelhulen/allReady,pranap/allReady,JowenMei/allReady,HTBox/allReady,JowenMei/allReady,gitChuckD/allReady,forestcheng/allReady,gitChuckD/allReady,jonhilt/allReady,joelhulen/allReady,kmlewis/allReady,shanecharles/allReady,stevejgordon/allReady,c0g1t8/allReady,jonatwabash/allReady,shanecharles/allReady,jonhilt/allReady,timstarbuck/allReady,MisterJames/allReady,mikesigs/allReady,binaryjanitor/allReady,gftrader/allReady,gftrader/allReady,binaryjanitor/allReady,HTBox/allReady,stevejgordon/allReady,jonhilt/allReady,forestcheng/allReady,mipre100/allReady,gitChuckD/allReady,GProulx/allReady,dpaquette/allReady,anobleperson/allReady,HTBox/allReady,mheggeseth/allReady,SteveStrong/allReady,dpaquette/allReady,dpaquette/allReady,BarryBurke/allReady,kmlewis/allReady,ksk100/allReady,gitChuckD/allReady,forestcheng/allReady,anobleperson/allReady,binaryjanitor/allReady,VishalMadhvani/allReady,bcbeatty/allReady,HTBox/allReady,kmlewis/allReady,ksk100/allReady,colhountech/allReady,bcbeatty/allReady,chinwobble/allReady,stevejgordon/allReady,BarryBurke/allReady,mikesigs/allReady,stevejgordon/allReady,pranap/allReady,BillWagner/allReady,BarryBurke/allReady,mipre100/allReady,kmlewis/allReady,GProulx/allReady,mgmccarthy/allReady,timstarbuck/allReady,HamidMosalla/allReady,colhountech/allReady,colhountech/allReady,gftrader/allReady,pranap/allReady,mipre100/allReady,SteveStrong/allReady,timstarbuck/allReady,aliiftikhar/allReady,arst/allReady,dangle1/allReady,shawnwildermuth/allReady,dangle1/allReady,c0g1t8/allReady,mikesigs/allReady,timstarbuck/allReady,HamidMosalla/allReady,anobleperson/allReady,gftrader/allReady,joelhulen/allReady,enderdickerson/allReady,HamidMosalla/allReady,chinwobble/allReady,shawnwildermuth/allReady,shanecharles/allReady,auroraocciduusadmin/allReady,MisterJames/allReady,joelhulen/allReady,mgmccarthy/allReady,aliiftikhar/allReady,shawnwildermuth/allReady,dangle1/allReady,shanecharles/allReady,anobleperson/allReady,shawnwildermuth/allReady,MisterJames/allReady,enderdickerson/allReady,auroraocciduusadmin/allReady,pranap/allReady,JowenMei/allReady,mheggeseth/allReady,arst/allReady,jonatwabash/allReady,HamidMosalla/allReady,GProulx/allReady,binaryjanitor/allReady,auroraocciduusadmin/allReady,SteveStrong/allReady,BarryBurke/allReady,mheggeseth/allReady,ksk100/allReady,dpaquette/allReady,jonhilt/allReady,aliiftikhar/allReady,VishalMadhvani/allReady,enderdickerson/allReady,ksk100/allReady,auroraocciduusadmin/allReady,MisterJames/allReady,GProulx/allReady,colhountech/allReady,bcbeatty/allReady,JowenMei/allReady,aliiftikhar/allReady,forestcheng/allReady,c0g1t8/allReady,enderdickerson/allReady,BillWagner/allReady,VishalMadhvani/allReady,BillWagner/allReady,arst/allReady,dangle1/allReady,mheggeseth/allReady,SteveStrong/allReady,VishalMadhvani/allReady,mgmccarthy/allReady,c0g1t8/allReady
AllReadyApp/Web-App/AllReady/Areas/Admin/Views/Site/EditUser.cshtml
AllReadyApp/Web-App/AllReady/Areas/Admin/Views/Site/EditUser.cshtml
@using AllReady.Areas.Admin.ViewModels @model EditUserViewModel @{ ViewData["Title"] = $"Edit User - {Model.UserName}"; } <h2>@ViewData["Title"]</h2> @using (Html.BeginForm()) { @Html.AntiForgeryToken() <div class="form-horizontal"> <hr /> <input asp-for="UserId" type="hidden" /> <div class="form-group"> <label asp-for="UserName" class="control-label col-md-2"></label> <div class="col-md-10"> <p class="form-control-static">@Model.UserName</p> </div> </div> <div class="form-group"> <label asp-for="IsTenantAdmin" class="control-label col-md-2"></label> <div class="col-md-10"> <input type="checkbox" name="IsTenantAdmin" class="bootstrap-toggle" asp-for="IsTenantAdmin" /> </div> </div> </div> } @section scripts { <script type="text/javascript"> $(".bootstrap-toggle").bootstrapToggle({ on: "Yes", off: "No" }); </script> }
@using AllReady.Areas.Admin.ViewModels @model EditUserViewModel @{ ViewData["Title"] = $"Edit User - {Model.UserName}"; } <h2>@ViewData["Title"]</h2> @using (Html.BeginForm()) { @Html.AntiForgeryToken() <div class="form-horizontal"> <hr /> <input asp-for="UserId" type="hidden" /> <div class="form-group"> <label asp-for="UserName" class="control-label col-md-2"></label> <div class="col-md-10"> @Html.DisplayFor(m => m.UserName) </div> </div> <div class="form-group"> <label asp-for="IsTenantAdmin" class="control-label col-md-2"></label> <div class="col-md-10"> <input type="checkbox" name="IsTenantAdmin" class="bootstrap-toggle" asp-for="IsTenantAdmin" /> </div> </div> </div> } @section scripts { <script type="text/javascript"> $(".bootstrap-toggle").bootstrapToggle({ on: "Yes", off: "No" }); </script> }
mit
C#
0cf4c8a794d1e79ef389c6db684efc369f8e1c76
fix exception file path
bordoley/RxApp
RxApp.Example.Android/RxAppExampleApplication.cs
RxApp.Example.Android/RxAppExampleApplication.cs
using System; using System.Collections.Generic; using System.IO; using System.Reactive.Disposables; using System.Reactive.Linq; using RxApp; using Android.App; using Android.Runtime; namespace RxApp.Example { [Application] public sealed class RxAppExampleApplication : RxApplication { private readonly RxAppExampleApplicationController applicationController; public RxAppExampleApplication(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer) { applicationController = new RxAppExampleApplicationController(this.NavigationStack); } public override Type GetActivityType(object model) { // This is a lot prettier in F# using pattern matching if (model is IMainViewModel) { return typeof(MainActivity); } throw new Exception("No view for view model"); } public override IDisposable ProvideController(object model) { return applicationController.Bind(model); } public override void OnCreate() { base.OnCreate(); AndroidEnvironment.UnhandledExceptionRaiser += (sender, args) => { var path = Context.GetExternalFilesDir("exceptions").Path; StreamWriter file = File.CreateText(path + "/exception.txt"); file.Write(args.Exception.StackTrace); // save the exception description and clean stack trace file.Close(); }; } public override void Start() { applicationController.Start(); } public override void Stop() { applicationController.Stop(); } } }
using System; using System.Collections.Generic; using System.IO; using System.Reactive.Disposables; using System.Reactive.Linq; using RxApp; using Android.App; using Android.Runtime; namespace RxApp.Example { [Application] public sealed class RxAppExampleApplication : RxApplication { private readonly RxAppExampleApplicationController applicationController; public RxAppExampleApplication(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer) { applicationController = new RxAppExampleApplicationController(this.NavigationStack); } public override Type GetActivityType(object model) { // This is a lot prettier in F# using pattern matching if (model is IMainViewModel) { return typeof(MainActivity); } throw new Exception("No view for view model"); } public override IDisposable ProvideController(object model) { return applicationController.Bind(model); } public override void OnCreate() { base.OnCreate(); AndroidEnvironment.UnhandledExceptionRaiser += (sender, args) => { var path = Context.GetExternalFilesDir("exceptions").Path; StreamWriter file = File.CreateText(path, "exception.txt"); file.Write(args.Exception.StackTrace); // save the exception description and clean stack trace file.Close(); }; } public override void Start() { applicationController.Start(); } public override void Stop() { applicationController.Stop(); } } }
apache-2.0
C#
4bea00d10e05fcd5f452449b4c2d4b953a009429
Fix for Twitter video
mika-f/Orion,OrionDevelop/Orion
Source/Orion.Shared/Absorb/Objects/Attachment.cs
Source/Orion.Shared/Absorb/Objects/Attachment.cs
using System.Linq; using Orion.Service.Mastodon.Enum; using Orion.Shared.Absorb.Enums; using CroudiaAttachment = Orion.Service.Croudia.Models.Media; using MastodonAttachment = Orion.Service.Mastodon.Models.Attachment; using TwitterAttachment = CoreTweet.MediaEntity; namespace Orion.Shared.Absorb.Objects { public class Attachment { private readonly CroudiaAttachment _croudiaAttachment; private readonly MastodonAttachment _mastodonAttachment; private readonly TwitterAttachment _twitterAttachment; /// <summary> /// URL /// </summary> public string Url { get; } /// <summary> /// Preview url /// </summary> public string PreviewUrl => _croudiaAttachment?.MediaUrl ?? _mastodonAttachment?.PreviewUrl ?? _twitterAttachment.MediaUrlHttps; public MediaType MediaType { get; } public Attachment(CroudiaAttachment attachment) { _croudiaAttachment = attachment; Url = attachment.MediaUrl; MediaType = MediaType.Image; } public Attachment(MastodonAttachment attachment) { _mastodonAttachment = attachment; Url = attachment.Url; MediaType = attachment.Type == AttachmentType.Video ? MediaType.Video : MediaType.Image; } public Attachment(TwitterAttachment attachment) { _twitterAttachment = attachment; Url = attachment.Type == "video" ? attachment.VideoInfo.Variants.First(w => w.Bitrate != null).Url : attachment.MediaUrlHttps; MediaType = attachment.Type == "photo" ? MediaType.Image : MediaType.Video; // ?? } } }
using Orion.Service.Mastodon.Enum; using Orion.Shared.Absorb.Enums; using CroudiaAttachment = Orion.Service.Croudia.Models.Media; using MastodonAttachment = Orion.Service.Mastodon.Models.Attachment; using TwitterAttachment = CoreTweet.MediaEntity; namespace Orion.Shared.Absorb.Objects { public class Attachment { private readonly CroudiaAttachment _croudiaAttachment; private readonly MastodonAttachment _mastodonAttachment; private readonly TwitterAttachment _twitterAttachment; /// <summary> /// URL /// </summary> public string Url => _croudiaAttachment?.MediaUrl ?? _mastodonAttachment?.Url ?? _twitterAttachment.MediaUrl; /// <summary> /// Preview url /// </summary> public string PreviewUrl => _croudiaAttachment?.MediaUrl ?? _mastodonAttachment?.PreviewUrl ?? _twitterAttachment.MediaUrlHttps; public MediaType MediaType { get; } public Attachment(CroudiaAttachment attachment) { _croudiaAttachment = attachment; MediaType = MediaType.Image; } public Attachment(MastodonAttachment attachment) { _mastodonAttachment = attachment; MediaType = attachment.Type == AttachmentType.Video ? MediaType.Video : MediaType.Image; } public Attachment(TwitterAttachment attachment) { _twitterAttachment = attachment; MediaType = attachment.Type == "photo" ? MediaType.Image : MediaType.Video; // ?? } } }
mit
C#
447fd2f954e8c220e7b700e808263862e76a9ca7
Update DotMinecraft.cs
111WARLOCK111/Craft.Net,Geptun/Chuckle.net,icedream/Craft.Net,SirCmpwn/Craft.Net,samuto/Craft.Net,darkcrash/Craft.Net
source/Craft.Net.Client/DotMinecraft.cs
source/Craft.Net.Client/DotMinecraft.cs
using System; using Craft.Net.Common; using System.IO; namespace Craft.Net.Client { public static class DotMinecraft { public static string GetDotMinecraftPath() { if (RuntimeInfo.IsLinux) return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), ".minecraft"); if (RuntimeInfo.IsMacOSX) return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "Library", "Application Support", ".minecraft"); return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), ".minecraft"); } } }
using System; using Craft.Net.Common; using System.IO; namespace Craft.Net.Client { public static class DotMinecraft { public static string GetDotMinecraftPath() { if (RuntimeInfo.IsLinux) return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), ".minecraft"); if (RuntimeInfo.IsMacOSX) Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "Library", "Application Support", ".minecraft"); return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), ".minecraft"); } } }
mit
C#
3a65077520524ce48b964287033f969730cf9935
Update Box.cs
dimmpixeye/Unity3dTools
Runtime/LibProcessors/Box.cs
Runtime/LibProcessors/Box.cs
// Project : ACTORS // Contacts : Pixeye - ask@pixeye.games using System; using System.Collections.Generic; using UnityEngine; using Object = UnityEngine.Object; namespace Pixeye.Framework { /// <summary> /// <para>Caches / return assets that Developer takes from the Resources folder. /// Box cleans cache when scene reloads.</para> /// </summary> public class Box : IKernel, IDisposable { /// <summary> /// <para>Caches / return assets that Developer takes from the Resources folder. /// Box cleans cache when scene reloads.</para> /// </summary> public static Box Default = new Box(); public static readonly string path = "/{0}"; internal Dictionary<int, Object> items = new Dictionary<int, Object>(20, FastComparable.Default); Dictionary<int, string> itemsPaths = new Dictionary<int, string>(20, FastComparable.Default); public static int StringToHash(string val) { var hash = val.GetHashCode(); Default.itemsPaths.Add(hash, val); return hash; } public static T Load<T>(string id) where T : Object { return Resources.Load<T>(id); } public static T[] LoadAll<T>(string id) where T : Object { return Resources.LoadAll<T>(id); } public static T[] LoadAll<T>(string id, int amount) where T : UnityEngine.Object { var storage = new T[amount]; for (int i = 0; i < amount; i++) storage[i] = Resources.Load<T>($"{id} {amount}"); return storage; } public static T Get<T>(string id) where T : Object { Object obj; var key = id.GetHashCode(); var hasValue = Default.items.TryGetValue(key, out obj); if (hasValue == false) { obj = Resources.Load<T>(id); Default.items.Add(key, obj); } return obj as T; } public static T Get<T>(int id) where T : Object { Object obj; if (Default.items.TryGetValue(id, out obj)) return obj as T; obj = Resources.Load(Default.itemsPaths[id]); Default.items.Add(id, obj); return obj as T; } public void Dispose() { items.Clear(); itemsPaths.Clear(); } } }
// Project : ACTORS // Contacts : Pixeye - ask@pixeye.games using System; using System.Collections.Generic; using UnityEngine; using Object = UnityEngine.Object; namespace Pixeye.Framework { /// <summary> /// <para>Caches / return assets that Developer takes from the Resources folder. /// Box cleans cache when scene reloads.</para> /// </summary> public class Box : IKernel, IDisposable { /// <summary> /// <para>Caches / return assets that Developer takes from the Resources folder. /// Box cleans cache when scene reloads.</para> /// </summary> public static Box Default = new Box(); public static readonly string path = "/{0}"; internal Dictionary<int, Object> items = new Dictionary<int, Object>(20, FastComparable.Default); Dictionary<int, string> itemsPaths = new Dictionary<int, string>(20, FastComparable.Default); public static int StringToHash(string val) { var hash = val.GetHashCode(); Default.itemsPaths.Add(hash, val); return hash; } public static T Load<T>(string id) where T : Object { return Resources.Load<T>(id); } public static T[] LoadAll<T>(string id) where T : Object { return Resources.LoadAll<T>(id); } public static T[] LoadAll<T>(string id, int amount) where T : UnityEngine.Object { storage = new T[amount]; for (int i = 0; i < amount; i++) storage[i] = Resources.Load<T>($"{id} {amount}"); return storage; } public static T Get<T>(string id) where T : Object { Object obj; var key = id.GetHashCode(); var hasValue = Default.items.TryGetValue(key, out obj); if (hasValue == false) { obj = Resources.Load<T>(id); Default.items.Add(key, obj); } return obj as T; } public static T Get<T>(int id) where T : Object { Object obj; if (Default.items.TryGetValue(id, out obj)) return obj as T; obj = Resources.Load(Default.itemsPaths[id]); Default.items.Add(id, obj); return obj as T; } public void Dispose() { items.Clear(); itemsPaths.Clear(); } } }
mit
C#
f15866ecaca47e44a55f20ba26d705110c98ef33
Add test for Range.Select
adamreeve/semver.net
SemVer.Tests/SimpleRanges.cs
SemVer.Tests/SimpleRanges.cs
using Xunit; namespace SemVer.Tests { public class SimpleRanges { [Fact] public void Test01() { var range = new Range(">=1.2.7 <1.3.0"); Assert.True(range.Match(new Version("1.2.7"))); Assert.True(range.Match(new Version("1.2.8"))); Assert.True(range.Match(new Version("1.2.99"))); Assert.False(range.Match(new Version("1.2.6"))); Assert.False(range.Match(new Version("1.3.0"))); Assert.False(range.Match(new Version("1.1.0"))); } [Fact] public void Test02() { var range = new Range("1.2.7 || >=1.2.9 <2.0.0"); Assert.True(range.Match(new Version("1.2.7"))); Assert.True(range.Match(new Version("1.2.9"))); Assert.True(range.Match(new Version("1.4.6"))); Assert.False(range.Match(new Version("1.2.8"))); Assert.False(range.Match(new Version("2.0.0"))); } [Fact] public void TestSelect() { var versions = new [] { new Version("1.2.7"), new Version("1.2.8"), new Version("1.2.99"), new Version("1.2.6"), new Version("1.3.0"), new Version("1.1.0"), }; var range = new Range(">=1.2.7 <1.3.0"); Assert.Equal( new Version("1.2.99"), range.Select(versions)); } } }
using Xunit; namespace SemVer.Tests { public class SimpleRanges { [Fact] public void Test01() { var range = new Range(">=1.2.7 <1.3.0"); Assert.True(range.Match(new Version("1.2.7"))); Assert.True(range.Match(new Version("1.2.8"))); Assert.True(range.Match(new Version("1.2.99"))); Assert.False(range.Match(new Version("1.2.6"))); Assert.False(range.Match(new Version("1.3.0"))); Assert.False(range.Match(new Version("1.1.0"))); } [Fact] public void Test02() { var range = new Range("1.2.7 || >=1.2.9 <2.0.0"); Assert.True(range.Match(new Version("1.2.7"))); Assert.True(range.Match(new Version("1.2.9"))); Assert.True(range.Match(new Version("1.4.6"))); Assert.False(range.Match(new Version("1.2.8"))); Assert.False(range.Match(new Version("2.0.0"))); } } }
mit
C#
e1c8ed9f496e08e2c3980fdaee5f264822ec7540
Add new members to Const class
lou1306/CIV,lou1306/CIV
CIV.Ccs/Const.cs
CIV.Ccs/Const.cs
using System; namespace CIV.Ccs { public static class Const { public static readonly string tau = GetLiteral(CcsLexer.TAU); public static readonly string nil = GetLiteral(CcsLexer.NIL); public static readonly string par = GetLiteral(CcsLexer.PAR); public static readonly string prefix = GetLiteral(CcsLexer.PREFIX); public static readonly string choice = GetLiteral(CcsLexer.CHOICE); public static readonly string restrictFormat = String.Format( "{{0}}{0}{1}{{1}}{2}", GetLiteral(CcsLexer.T__1), GetLiteral(CcsLexer.LBRACE), GetLiteral(CcsLexer.RBRACE)); public static readonly string relabelFormat = String.Format( "{{0}}{0}{{1}}{1}", GetLiteral(CcsLexer.LBRACK), GetLiteral(CcsLexer.RBRACK)); static string GetLiteral(int id) { return CcsLexer.DefaultVocabulary .GetLiteralName(id) .Replace("'", ""); } } }
namespace CIV.Ccs { public static class Const { public const string tau = "tau"; } }
mit
C#
4e777ffdff4e53d43c1d6c9b12fcf232a7861626
Fix weird crashes
arcaneex/hash,Rohansi/RohBot,arcaneex/hash,Rohansi/RohBot,Rohansi/RohBot,arcaneex/hash,Rohansi/RohBot,arcaneex/hash
SteamMobile/TaskScheduler.cs
SteamMobile/TaskScheduler.cs
using System; using System.Collections.Generic; using System.Diagnostics; namespace SteamMobile { public class TaskScheduler { private class Task { public double Delay; public double Accumulator; public Action Callback; public Task(double delay, Action callback) { Delay = delay; Accumulator = 0; Callback = callback; } } private List<Task> _tasks; private Stopwatch _timer; public TaskScheduler() { _tasks = new List<Task>(); _timer = Stopwatch.StartNew(); } public void Add(TimeSpan delay, Action callback) { lock (_tasks) _tasks.Add(new Task(delay.TotalSeconds, callback)); } public void Run() { lock (_tasks) { var timeOffset = _timer.Elapsed.TotalSeconds; _timer.Restart(); foreach (var task in _tasks) { task.Accumulator += timeOffset; if (task.Accumulator < task.Delay) continue; try { task.Callback(); } catch (Exception e) { Program.Logger.Error("Failed to run task", e); } task.Accumulator -= task.Delay; } } } } }
using System; using System.Collections.Generic; using System.Diagnostics; namespace SteamMobile { public class TaskScheduler { private class Task { public double Delay; public double Accumulator; public Action Callback; public Task(double delay, Action callback) { Delay = delay; Accumulator = 0; Callback = callback; } } private List<Task> _tasks; private Stopwatch _timer; public TaskScheduler() { _tasks = new List<Task>(); _timer = Stopwatch.StartNew(); } public void Add(TimeSpan delay, Action callback) { lock (_tasks) _tasks.Add(new Task(delay.TotalSeconds, callback)); } public void Run() { lock (_tasks) { var timeOffset = _timer.Elapsed.TotalSeconds; _timer.Restart(); foreach (var task in _tasks) { task.Accumulator += timeOffset; if (task.Accumulator < task.Delay) continue; task.Callback(); task.Accumulator -= task.Delay; } } } } }
mit
C#
a32f5d44e279f617ad2933b28f26c0d0250882d6
Improve clarity of xmldoc
peppy/osu,smoogipoo/osu,peppy/osu-new,ppy/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu,NeoAdonis/osu,ppy/osu,smoogipooo/osu,peppy/osu,smoogipoo/osu,peppy/osu
osu.Game/Database/IRealmFactory.cs
osu.Game/Database/IRealmFactory.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 Realms; namespace osu.Game.Database { public interface IRealmFactory { /// <summary> /// The main realm context, bound to the update thread. /// </summary> Realm Context { get; } /// <summary> /// Create a new realm context for use on the current thread. /// </summary> Realm CreateContext(); } }
// 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 Realms; namespace osu.Game.Database { public interface IRealmFactory { /// <summary> /// The main realm context, bound to the update thread. /// </summary> Realm Context { get; } /// <summary> /// Create a new realm context for use on an arbitrary thread. /// </summary> Realm CreateContext(); } }
mit
C#
3747b66011cd0c47a4c122f27ccfbb0c310d696d
fix the assembly version file
blackducksoftware/hub-nuget
BuildBomTask/Properties/AssemblyInfo.cs
BuildBomTask/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("BuildBomTask")] [assembly: AssemblyDescription("MSBuild tasks to generate Black Duck I/O output for a solution or project")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Black Duck Software")] [assembly: AssemblyProduct("BuildBomTask")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("8829ab44-952b-4361-9694-e887c6450b45")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.0.1.0")] [assembly: AssemblyFileVersion("0.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("BdioTask")] [assembly: AssemblyDescription("MSBuild tasks to generate Black Duck I/O output for a solution or project")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BdioTask")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("8829ab44-952b-4361-9694-e887c6450b45")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.0.1.0")] [assembly: AssemblyFileVersion("0.0.1.0")]
apache-2.0
C#
95732ba67f49da9c34914245ccfd1516bec6916d
Change in Version Numbering
typeset/typeset
Typeset.Common/GlobalAssemblyInfo.cs
Typeset.Common/GlobalAssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Typeset")] [assembly: AssemblyCopyright("Copyright © Bates Westmoreland 2012")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: AssemblyVersion("0.2.1")] [assembly: AssemblyFileVersion("0.2.1")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Typeset")] [assembly: AssemblyCopyright("Copyright © Bates Westmoreland 2012")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: AssemblyVersion("0.2.1.0")] [assembly: AssemblyFileVersion("0.2.1.0")]
mit
C#
1c7613c98225772affe228f60b49bae29807a873
Write command exception message to the console
appharbor/appharbor-cli
src/AppHarbor/CommandDispatcher.cs
src/AppHarbor/CommandDispatcher.cs
using System; using System.Linq; using System.Collections.Generic; namespace AppHarbor { public class CommandDispatcher { private readonly IEnumerable<ICommand> _commands; public CommandDispatcher(IEnumerable<ICommand> commands) { _commands = commands; } public void Dispatch(string[] args) { var commandName = args[0]; var command = _commands.FirstOrDefault(x => x.GetType().Name.ToLower().StartsWith(commandName.ToLower())); if (command == null) { throw new ArgumentException(string.Format("The command \"{0}\" does not exist", commandName)); } try { command.Execute(args.Skip(1).ToArray()); } catch (CommandException exception) { Console.WriteLine(string.Format("Error: {0}", exception.Message)); } } } }
using System; using System.Linq; using System.Collections.Generic; namespace AppHarbor { public class CommandDispatcher { private readonly IEnumerable<ICommand> _commands; public CommandDispatcher(IEnumerable<ICommand> commands) { _commands = commands; } public void Dispatch(string[] args) { var commandName = args[0]; var command = _commands.FirstOrDefault(x => x.GetType().Name.ToLower().StartsWith(commandName.ToLower())); if (command == null) { throw new ArgumentException(string.Format("The command \"{0}\" does not exist", commandName)); } command.Execute(args.Skip(1).ToArray()); } } }
mit
C#
9368431a76cbe3a362193c4ad789a1c8b5a21a41
Fix pattern matching
Krusen/Additio.Sitecore.DependencyConfigReader
src/Additio.Configuration/DependencyLoader.cs
src/Additio.Configuration/DependencyLoader.cs
using System; using System.Collections.Generic; using System.Linq; using System.Xml.Linq; namespace Additio.Configuration { public interface IDependencyLoader { IEnumerable<string> GetDependencyPatterns(string configFile); } public class DependencyLoader : IDependencyLoader { protected const string DependencyAttributeName = "dependencies"; protected static readonly char[] Separators = {',', ';', '|'}; public virtual IEnumerable<string> GetDependencyPatterns(string configFile) { var value = GetDependencyAttributeValue(configFile); if (string.IsNullOrWhiteSpace(value)) return Enumerable.Empty<string>(); return value.Split(Separators, StringSplitOptions.RemoveEmptyEntries).Select(NormalizePattern); } protected virtual string NormalizePattern(string pattern) { pattern = pattern.ToLowerInvariant().Replace('/', '\\').TrimStart('\\'); if (!pattern.EndsWith(".config")) pattern += ".config"; return pattern; } protected virtual string GetDependencyAttributeValue(string configFile) { var attributes = XElement.Load(configFile).Attributes(); var attribute = attributes.FirstOrDefault( x => string.Equals(x.Name.ToString(), DependencyAttributeName, StringComparison.OrdinalIgnoreCase)); return attribute?.Value; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Xml.Linq; namespace Additio.Configuration { public interface IDependencyLoader { IEnumerable<string> GetDependencyPatterns(string configFile); } public class DependencyLoader : IDependencyLoader { protected const string DependencyAttributeName = "dependencies"; protected static readonly char[] Separators = {',', ';', '|'}; public virtual IEnumerable<string> GetDependencyPatterns(string configFile) { var value = GetDependencyAttributeValue(configFile); if (string.IsNullOrWhiteSpace(value)) return Enumerable.Empty<string>(); value = value.Replace('/', '\\').Replace(".config", ""); return value.Split(Separators, StringSplitOptions.RemoveEmptyEntries).Select(x => x.TrimStart('\\')); } protected virtual string GetDependencyAttributeValue(string configFile) { var attributes = XElement.Load(configFile).Attributes(); var attribute = attributes.FirstOrDefault( x => string.Equals(x.Name.ToString(), DependencyAttributeName, StringComparison.OrdinalIgnoreCase)); return attribute?.Value; } } }
unlicense
C#
473787d42ac0e488560b0102715972bf4802aa31
Update IPathConverter.cs
wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D
src/Core2D/Model/Interfaces/IPathConverter.cs
src/Core2D/Model/Interfaces/IPathConverter.cs
using System.Collections.Generic; using Core2D.Renderer; using Core2D.Shapes; namespace Core2D.Interfaces { /// <summary> /// Defines path converter contract. /// </summary> public interface IPathConverter { /// <summary> /// Convert shapes to path shape. /// </summary> /// <param name="shapes">The shapes to convert.</param> /// <returns>The new instance of object of type <see cref="IPathShape"/>.</returns> IPathShape ToPathShape(IEnumerable<IBaseShape> shapes); /// <summary> /// Convert shape to path shape. /// </summary> /// <param name="shape">The shape to convert.</param> /// <returns>The new instance of object of type <see cref="IPathShape"/>.</returns> IPathShape ToPathShape(IBaseShape shape); /// <summary> /// Convert shape to stroke path shape. /// </summary> /// <param name="shape">The shape to convert.</param> /// <returns>The new instance of object of type <see cref="IPathShape"/>.</returns> IPathShape ToStrokePathShape(IBaseShape shape); /// <summary> /// Convert shape to fill path shape. /// </summary> /// <param name="shape">The shape to convert.</param> /// <returns>The new instance of object of type <see cref="IPathShape"/>.</returns> IPathShape ToFillPathShape(IBaseShape shape); /// <summary> /// Convert shapes to path shape. /// </summary> /// <param name="shapes">The shapes to convert.</param> /// <param name="op">The convert operation.</param> /// <returns>The new instance of object of type <see cref="IPathShape"/>.</returns> IPathShape Op(IEnumerable<IBaseShape> shapes, PathOp op); } }
using System.Collections.Generic; using Core2D.Renderer; using Core2D.Shapes; namespace Core2D.Interfaces { /// <summary> /// Defines path converter contract. /// </summary> public interface IPathConverter { /// <summary> /// Convert shape to path shape. /// </summary> /// <param name="shape">The shape to convert.</param> /// <returns>The new instance of object of type <see cref="IPathShape"/>.</returns> IPathShape ToPathShape(IBaseShape shape); /// <summary> /// Convert shape to stroke path shape. /// </summary> /// <param name="shape">The shape to convert.</param> /// <returns>The new instance of object of type <see cref="IPathShape"/>.</returns> IPathShape ToStrokePathShape(IBaseShape shape); /// <summary> /// Convert shape to fill path shape. /// </summary> /// <param name="shape">The shape to convert.</param> /// <returns>The new instance of object of type <see cref="IPathShape"/>.</returns> IPathShape ToFillPathShape(IBaseShape shape); /// <summary> /// Convert shapes to path shape. /// </summary> /// <param name="shapes">The shapes to convert.</param> /// <param name="op">The convert operation.</param> /// <returns>The new instance of object of type <see cref="IPathShape"/>.</returns> IPathShape Op(IEnumerable<IBaseShape> shapes, PathOp op); } }
mit
C#
97a6d2d178161846b1a1afd6598d3157f7c1d678
Simplify NUnitLite
nivanov1984/nunit,OmicronPersei/nunit,Green-Bug/nunit,Green-Bug/nunit,jadarnel27/nunit,agray/nunit,nivanov1984/nunit,jnm2/nunit,ChrisMaddock/nunit,mikkelbu/nunit,ggeurts/nunit,jadarnel27/nunit,danielmarbach/nunit,JustinRChou/nunit,mjedrzejek/nunit,agray/nunit,nunit/nunit,JustinRChou/nunit,Suremaker/nunit,appel1/nunit,ggeurts/nunit,Green-Bug/nunit,agray/nunit,Suremaker/nunit,danielmarbach/nunit,nunit/nunit,jnm2/nunit,danielmarbach/nunit,mikkelbu/nunit,NikolayPianikov/nunit,mjedrzejek/nunit,appel1/nunit,ChrisMaddock/nunit,OmicronPersei/nunit,NikolayPianikov/nunit
src/NUnitFramework/nunitlite.tests/Program.cs
src/NUnitFramework/nunitlite.tests/Program.cs
using System; using System.Collections.Generic; using System.Reflection; using System.Text; using NUnit.Common; namespace NUnitLite.Tests { class Program { public static int Main(string[] args) { #if NETCOREAPP1_0 || PORTABLE return new AutoRun(Assembly.GetEntryAssembly()).Execute(args, new ColorConsoleWriter(), Console.In); #else return new AutoRun().Execute(args); #endif } } }
using System; using System.Collections.Generic; using System.Reflection; using System.Text; using NUnit.Common; namespace NUnitLite.Tests { class Program { public static int Main(string[] args) { #if NETCOREAPP1_0 return new AutoRun(Assembly.GetEntryAssembly()).Execute(args, new ColorConsoleWriter(), Console.In); #elif PORTABLE return new AutoRun(typeof(Program).Assembly).Execute(args, new ColorConsoleWriter(), Console.In); #else return new AutoRun().Execute(args); #endif } } }
mit
C#
d63deb3273303eeac0a5681c2e83734ae1acadd4
Add MaxLength property to text boxes
kswoll/WootzJs,x335/WootzJs,kswoll/WootzJs,x335/WootzJs,x335/WootzJs,kswoll/WootzJs
WootzJs.Mvc/Views/TextBox.cs
WootzJs.Mvc/Views/TextBox.cs
using System; using System.Runtime.WootzJs; using WootzJs.Web; namespace WootzJs.Mvc.Views { public class TextBox : Control { public event Action Changed; public new InputElement Node { get { return base.Node.As<InputElement>(); } } public TextBoxType Type { get { return TextBoxTypes.Parse(Node.GetAttribute("type")); } set { Node.SetAttribute("type", value.GetInputType()); } } public string Name { get { return Node.GetAttribute("name"); } set { Node.SetAttribute("name", value); } } public string Placeholder { get { return Node.GetAttribute("placeholder"); } set { Node.SetAttribute("placeholder", value); } } public int? MaxLength { get { var maxLength = Node.GetAttribute("maxlength"); return maxLength != null ? (int?)int.Parse(maxLength) : null; } set { if (value != null) Node.SetAttribute("maxlength", value.Value.ToString()); else Node.RemoveAttribute("maxlength"); } } protected override Element CreateNode() { var textBox = Browser.Document.CreateElement("input"); textBox.SetAttribute("type", "text"); textBox.AddEventListener("change", OnJsChanged); return textBox; } private void OnJsChanged(Event evt) { var changed = Changed; if (changed != null) changed(); } public string Text { get { EnsureNodeExists(); return Node.Value; } set { EnsureNodeExists(); Node.Value = value; } } } }
using System; using System.Runtime.WootzJs; using WootzJs.Web; namespace WootzJs.Mvc.Views { public class TextBox : Control { public event Action Changed; public new InputElement Node { get { return base.Node.As<InputElement>(); } } public TextBoxType Type { get { return TextBoxTypes.Parse(Node.GetAttribute("type")); } set { Node.SetAttribute("type", value.GetInputType()); } } public string Name { get { return Node.GetAttribute("name"); } set { Node.SetAttribute("name", value); } } public string Placeholder { get { return Node.GetAttribute("placeholder"); } set { Node.SetAttribute("placeholder", value); } } protected override Element CreateNode() { var textBox = Browser.Document.CreateElement("input"); textBox.SetAttribute("type", "text"); textBox.AddEventListener("change", OnJsChanged); return textBox; } private void OnJsChanged(Event evt) { var changed = Changed; if (changed != null) changed(); } public string Text { get { EnsureNodeExists(); return Node.Value; } set { EnsureNodeExists(); Node.Value = value; } } } }
mit
C#
9b1352085aa64c4c5df8e3445d77f874d7f07a9b
Fix install modules command (#19)
Sitecore/Sitecore-Instance-Manager,Brad-Christie/Sitecore-Instance-Manager,sergeyshushlyapin/Sitecore-Instance-Manager
src/SIM.Core/Commands/InstallModuleCommand.cs
src/SIM.Core/Commands/InstallModuleCommand.cs
namespace SIM.Core.Commands { using System.IO; using System.Linq; using Sitecore.Diagnostics.Base; using JetBrains.Annotations; using SIM.Core.Common; using SIM.Instances; using SIM.IO; using SIM.Pipelines; using SIM.Pipelines.InstallModules; using SIM.Products; public class InstallModuleCommand : AbstractCommand<string[]> { [CanBeNull] public virtual string Name { get; [UsedImplicitly] set; } [CanBeNull] public virtual string Module { get; [UsedImplicitly] set; } [CanBeNull] public virtual string Version { get; [UsedImplicitly] set; } [CanBeNull] public virtual string Revision { get; [UsedImplicitly] set; } protected override void DoExecute(CommandResult<string[]> result) { Assert.ArgumentNotNull(result, nameof(result)); var name = Name; Assert.ArgumentNotNullOrEmpty(name, nameof(name)); var product = Module; var version = Version; var revision = Revision; var profile = Profile.Read(FileSystem); var repository = profile.LocalRepository; Ensure.IsNotNullOrEmpty(repository, "Profile.LocalRepository is not specified"); Ensure.IsTrue(Directory.Exists(repository), "Profile.LocalRepository points to missing location"); var license = profile.License; Ensure.IsNotNullOrEmpty(license, "Profile.License is not specified"); Ensure.IsTrue(File.Exists(license), "Profile.License points to missing file"); var connectionString = profile.GetValidConnectionString(); var instance = InstanceManager.Default.GetInstance(name); Ensure.IsNotNull(instance, "The {0} instance is not found", name); ProductManager.Initialize(repository); var distributive = ProductManager.FindProduct(ProductType.Module, product, version, revision); Ensure.IsNotNull(distributive, "product is not found"); PipelineManager.Initialize(XmlDocumentEx.LoadXml(PipelinesConfig.Contents).DocumentElement); var args = new InstallModulesArgs(instance, new[] { distributive }, connectionString); var controller = new AggregatePipelineController(); PipelineManager.StartPipeline("installmodules", args, controller, false); result.Success = !string.IsNullOrEmpty(controller.Message); result.Message = controller.Message; result.Data = controller.GetMessages().ToArray(); } public InstallModuleCommand([NotNull] IFileSystem fileSystem) : base(fileSystem) { } } }
namespace SIM.Core.Commands { using System.IO; using System.Linq; using Sitecore.Diagnostics.Base; using JetBrains.Annotations; using SIM.Core.Common; using SIM.Instances; using SIM.IO; using SIM.Pipelines; using SIM.Pipelines.InstallModules; using SIM.Products; public class InstallModuleCommand : AbstractCommand<string[]> { [CanBeNull] public virtual string Name { get; [UsedImplicitly] set; } [CanBeNull] public virtual string Module { get; [UsedImplicitly] set; } [CanBeNull] public virtual string Version { get; [UsedImplicitly] set; } [CanBeNull] public virtual string Revision { get; [UsedImplicitly] set; } protected override void DoExecute(CommandResult<string[]> result) { Assert.ArgumentNotNull(result, nameof(result)); var name = Name; Assert.ArgumentNotNullOrEmpty(name, nameof(name)); var product = Module; var version = Version; var revision = Revision; var profile = Profile.Read(FileSystem); var repository = profile.LocalRepository; Ensure.IsNotNullOrEmpty(repository, "Profile.LocalRepository is not specified"); Ensure.IsTrue(Directory.Exists(repository), "Profile.LocalRepository points to missing location"); var license = profile.License; Ensure.IsNotNullOrEmpty(license, "Profile.License is not specified"); Ensure.IsTrue(File.Exists(license), "Profile.License points to missing file"); var builder = profile.GetValidConnectionString(); var instance = InstanceManager.Default.GetInstance(name); Ensure.IsNotNull(instance, "The {0} instance is not found", name); ProductManager.Initialize(repository); var distributive = ProductManager.FindProduct(ProductType.Module, product, version, revision); Ensure.IsNotNull(distributive, "product is not found"); PipelineManager.Initialize(XmlDocumentEx.LoadXml(PipelinesConfig.Contents).DocumentElement); var installArgs = new InstallModulesArgs(instance, new[] { distributive }, builder); var controller = new AggregatePipelineController(); PipelineManager.StartPipeline("install", installArgs, controller, false); result.Success = !string.IsNullOrEmpty(controller.Message); result.Message = controller.Message; result.Data = controller.GetMessages().ToArray(); } public InstallModuleCommand([NotNull] IFileSystem fileSystem) : base(fileSystem) { } } }
mit
C#
62d721a96b9a77a0b89d9af37f8871913d5b6abb
switch to thread sleep
jefking/King.Service.ServiceBus
King.Service.ServiceBus/Timing/Sleep.cs
King.Service.ServiceBus/Timing/Sleep.cs
namespace King.Service.ServiceBus.Timing { using System; using System.Threading; /// <summary> /// Sleep /// </summary> public class Sleep : ISleep { #region Methods /// <summary> /// Until /// </summary> /// <param name="time">Time</param> public void Until(DateTime time) { if (time > DateTime.UtcNow) { Thread.Sleep(time.Subtract(DateTime.UtcNow).Add(TimeSpan.FromMilliseconds(-10))); while (time > DateTime.UtcNow) { } //Ensure release is made after specified timing } } #endregion } }
namespace King.Service.ServiceBus.Timing { using System; using System.Threading; /// <summary> /// Sleep /// </summary> public class Sleep : ISleep { #region Methods /// <summary> /// Until /// </summary> /// <param name="time">Time</param> public void Until(DateTime time) { if (time > DateTime.UtcNow) { var reset = new ManualResetEvent(false); reset.WaitOne(time.Subtract(DateTime.UtcNow)); while (time >= DateTime.UtcNow) { } //Ensure release is made after specified timing } } #endregion } }
mit
C#
64cf07049c4e07927faeafccf6f50a96a8d4935b
Make ChangeDate and RemoveDate fields of BaseEntity nullable
denismaster/dcs,denismaster/dcs,denismaster/dcs,denismaster/dcs
src/Diploms.Core/Entities/BaseEntity.cs
src/Diploms.Core/Entities/BaseEntity.cs
using System; namespace Diploms.Core { public abstract class BaseEntity : IEntity { public int Id { get; set; } public DateTime CreateDate { get; set; } public DateTime? ChangeDate { get; set; } public DateTime? RemoveDate { get; set; } } }
using System; namespace Diploms.Core { public abstract class BaseEntity : IEntity { public int Id { get; set; } public DateTime CreateDate { get; set; } public DateTime ChangeDate { get; set; } public DateTime RemoveDate { get; set; } } }
mit
C#
cd01ab192e7dc80cfb9b1b1b0785d1a4349e1e8c
Hide window when minimizing
szarvas/fanduino,szarvas/fanduino
FanduinoWindow/Form1.cs
FanduinoWindow/Form1.cs
/* Copyright 2016 Attila Szarvas Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ using System; using System.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; using Microsoft.Win32; using System.IO; namespace FanduinoWindow { public partial class Form1 : Form { public Form1() { InitializeComponent(); if (Fanduino.Config.startMinimized) { WindowState = FormWindowState.Minimized; Form1_Resize(this, null); } } delegate void SetTextCallback(string text); public void SetText(String msg) { if (this.label1.InvokeRequired) { this.Invoke(new SetTextCallback(SetText), new object[] { msg }); } else { this.label1.Text = msg; } } private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e) { this.WindowState = FormWindowState.Normal; this.ShowInTaskbar = true; Show(); notifyIcon1.Visible = false; } private void Form1_Resize(object sender, EventArgs e) { if (this.WindowState == FormWindowState.Minimized) { notifyIcon1.Visible = true; Hide(); this.ShowInTaskbar = false; } } } }
/* Copyright 2016 Attila Szarvas Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ using System; using System.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; using Microsoft.Win32; using System.IO; namespace FanduinoWindow { public partial class Form1 : Form { public Form1() { InitializeComponent(); if (Fanduino.Config.startMinimized) { WindowState = FormWindowState.Minimized; Form1_Resize(this, null); } } delegate void SetTextCallback(string text); public void SetText(String msg) { if (this.label1.InvokeRequired) { this.Invoke(new SetTextCallback(SetText), new object[] { msg }); } else { this.label1.Text = msg; } } private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e) { this.WindowState = FormWindowState.Normal; this.ShowInTaskbar = true; notifyIcon1.Visible = false; } private void Form1_Resize(object sender, EventArgs e) { if (this.WindowState == FormWindowState.Minimized) { notifyIcon1.Visible = true; this.ShowInTaskbar = false; } } } }
apache-2.0
C#
ed6a29a9c1718bd47bd4f9fab43bd35448f7a6b6
Make TaroEnvironment.EventDispatcher public so we can set a different dispatcher
mouhong/Taro
src/Taro/Config/TaroEnvironment.cs
src/Taro/Config/TaroEnvironment.cs
using System; using System.Collections.Generic; using System.Reflection; using Taro.Dispatching; namespace Taro.Config { public class TaroEnvironment { public static readonly TaroEnvironment Instance = new TaroEnvironment(); public IEventDispatcher EventDispatcher { get; set; } private TaroEnvironment() { } public static void Configure(Action<TaroEnvironment> action) { Require.NotNull(action, "action"); action(Instance); } public TaroEnvironment UsingDefaultEventDispatcher(params Assembly[] handlerAssemblies) { return UsingDefaultEventDispatcher(handlerAssemblies as IEnumerable<Assembly>); } public TaroEnvironment UsingDefaultEventDispatcher(IEnumerable<Assembly> handlerAssemblies) { Require.NotNull(handlerAssemblies, "handlerAssemblies"); var registry = new DefaultEventHandlerRegistry(); registry.RegisterAssemblies(handlerAssemblies); EventDispatcher = new DefaultEventDispatcher(registry); return this; } } }
using System; using System.Collections.Generic; using System.Reflection; using Taro.Dispatching; namespace Taro.Config { public class TaroEnvironment { public static readonly TaroEnvironment Instance = new TaroEnvironment(); public IEventDispatcher EventDispatcher { get; private set; } private TaroEnvironment() { } public static void Configure(Action<TaroEnvironment> action) { Require.NotNull(action, "action"); action(Instance); } public TaroEnvironment UsingDefaultEventDispatcher(params Assembly[] handlerAssemblies) { return UsingDefaultEventDispatcher(handlerAssemblies as IEnumerable<Assembly>); } public TaroEnvironment UsingDefaultEventDispatcher(IEnumerable<Assembly> handlerAssemblies) { Require.NotNull(handlerAssemblies, "handlerAssemblies"); var registry = new DefaultEventHandlerRegistry(); registry.RegisterAssemblies(handlerAssemblies); EventDispatcher = new DefaultEventDispatcher(registry); return this; } } }
apache-2.0
C#
5debe5c4cca0511da318024f93c14fb605f5f36a
add extractCsvRow()
yasokada/unity-150825-TELChecker
Assets/CheckButtonControl.cs
Assets/CheckButtonControl.cs
using UnityEngine; using System.Collections; using UnityEngine.UI; using System.Linq; // for Where using System.Collections.Generic; using System; // for StringSplitOptions.RemoveEmptyEntries public class CheckButtonControl : MonoBehaviour { public const string kTitle = "<title>"; public Text resText; // to show check result public InputField IFtelno; // for input telephone number public InputField IFinfo; // to show/input hospital name static private Dictionary<string,string> telbook = new Dictionary<string, string>(); void Start() { IFtelno.text = "0729883121"; // TODO: remove // for test } string getHospitalName(string txt, string telno) { string removed = txt.Substring (kTitle.Length, 30); // check with first 2 characters string lhs = removed.Substring (0, 2); string rhs = telno.Substring (0, 2); if (lhs.Equals (rhs)) { return "not registered"; } return removed; } string removeHyphen(string src) { var dst = new string (src.Where (c => !"-".Contains (c)).ToArray ()); return dst; } bool hasObtainedTelNo(string src) { if (src.ToLower ().Contains ("not")) { return false; } return true; } IEnumerator checkHospitalTelephoneNumber() { string telno = IFtelno.text; // remove "-" from telno telno = removeHyphen (telno); if (telbook.ContainsKey (telno)) { IFinfo.text = "dic:" + telbook[telno]; yield break; } string url = "http://www.jpcaller.com/phone/"; WWW web = new WWW(url + telno); yield return web; string res = web.text; int pos = res.IndexOf (kTitle); resText.text = "not found"; IFinfo.text = ""; if (pos > 0) { res = getHospitalName(web.text.Substring(pos, 40), telno); resText.text = extractCsvRow(res, 0); if (hasObtainedTelNo(res)) { IFinfo.text = resText.text; } } } void addDictionary(string telno, string name) { if (telbook.ContainsKey (telno) == false) { telbook.Add (telno, name); Debug.Log("added"); } } public void CheckButtonOnClick() { StartCoroutine("checkHospitalTelephoneNumber"); } public void AddButtonOnClick() { string telno = removeHyphen (IFtelno.text); addDictionary (telno, IFinfo.text); } private string extractCsvRow(string src, int idx) { string[] splitted = src.Split(new string[] { System.Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries); string res = ""; foreach(string each in splitted) { string [] elements = each.Split(' '); res = res + elements[idx] + System.Environment.NewLine; } return res; } }
using UnityEngine; using System.Collections; using UnityEngine.UI; using System.Linq; // for Where using System.Collections.Generic; public class CheckButtonControl : MonoBehaviour { public const string kTitle = "<title>"; public Text resText; // to show check result public InputField IFtelno; // for input telephone number public InputField IFinfo; // to show/input hospital name static private Dictionary<string,string> telbook = new Dictionary<string, string>(); void Start() { IFtelno.text = "0729883121"; // TODO: remove // for test } string getHospitalName(string txt, string telno) { string removed = txt.Substring (kTitle.Length, 30); // check with first 2 characters string lhs = removed.Substring (0, 2); string rhs = telno.Substring (0, 2); if (lhs.Equals (rhs)) { return "not registered"; } return removed; } string removeHyphen(string src) { var dst = new string (src.Where (c => !"-".Contains (c)).ToArray ()); return dst; } bool hasObtainedTelNo(string src) { if (src.ToLower ().Contains ("not")) { return false; } return true; } IEnumerator checkHospitalTelephoneNumber() { string telno = IFtelno.text; // remove "-" from telno telno = removeHyphen (telno); if (telbook.ContainsKey (telno)) { IFinfo.text = "dic:" + telbook[telno]; yield break; } string url = "http://www.jpcaller.com/phone/"; WWW web = new WWW(url + telno); yield return web; string res = web.text; int pos = res.IndexOf (kTitle); resText.text = "not found"; IFinfo.text = ""; if (pos > 0) { res = getHospitalName(web.text.Substring(pos, 40), telno); resText.text = res; if (hasObtainedTelNo(res)) { IFinfo.text = resText.text; } } } void addDictionary(string telno, string name) { if (telbook.ContainsKey (telno) == false) { telbook.Add (telno, name); Debug.Log("added"); } } public void CheckButtonOnClick() { StartCoroutine("checkHospitalTelephoneNumber"); } public void AddButtonOnClick() { string telno = removeHyphen (IFtelno.text); addDictionary (telno, IFinfo.text); } }
mit
C#
e84601a7a360b8b5cc5f7f93d33937aa0cb065c5
fix indents
chraft/c-raft
Chraft/Client.Persistence.cs
Chraft/Client.Persistence.cs
using Chraft.Properties; using System.IO; using System.Xml.Serialization; using Chraft.Persistence; namespace Chraft { public partial class Client { private static XmlSerializer Xml = new XmlSerializer(typeof(ClientSurrogate)); internal string Folder { get { return Settings.Default.PlayersFolder; } } internal string DataFile { get { return Folder + "/" + Username + ".xml"; } } // TODO: Move a bunch of this to DataFile.cs private void Load() { if (!File.Exists(DataFile)) return; ClientSurrogate client; using (FileStream rx = File.OpenRead(DataFile)) client = (ClientSurrogate)Xml.Deserialize(rx); Position.X = client.X; Position.Y = client.Y + 1; // Players drop one block upon spawning Position.Z = client.Z; Yaw = client.Yaw; Pitch = client.Pitch; if (client.Inventory == null) return; Inventory = client.Inventory; Inventory.Associate(this); } private void Save() { if (!Directory.Exists(Folder)) Directory.CreateDirectory(Folder); string file = DataFile + ".tmp"; try { using (FileStream tx = File.Create(file)) { Xml.Serialize(tx, new ClientSurrogate { Inventory = Inventory, X = Position.X, Y = Position.Y, Z = Position.Z, Yaw = Yaw, Pitch = Pitch }); tx.Flush(); tx.Close(); } } catch (IOException) { return; } if (File.Exists(DataFile)) File.Delete(DataFile); File.Move(file, DataFile); } } }
using Chraft.Properties; using System.IO; using System.Xml.Serialization; using Chraft.Persistence; namespace Chraft { public partial class Client { private static XmlSerializer Xml = new XmlSerializer(typeof(ClientSurrogate)); internal string Folder { get { return Settings.Default.PlayersFolder; } } internal string DataFile { get { return Folder + "/" + Username + ".xml"; } } // TODO: Move a bunch of this to DataFile.cs private void Load() { if (!File.Exists(DataFile)) return; ClientSurrogate client; using (FileStream rx = File.OpenRead(DataFile)) client = (ClientSurrogate)Xml.Deserialize(rx); Position.X = client.X; Position.Y = client.Y + 1; // Players drop one block upon spawning Position.Z = client.Z; Yaw = client.Yaw; Pitch = client.Pitch; if (client.Inventory == null) return; Inventory = client.Inventory; Inventory.Associate(this); } private void Save() { if (!Directory.Exists(Folder)) Directory.CreateDirectory(Folder); string file = DataFile + ".tmp"; try { using (FileStream tx = File.Create(file)) { Xml.Serialize(tx, new ClientSurrogate { Inventory = Inventory, X = Position.X, Y = Position.Y, Z = Position.Z, Yaw = Yaw, Pitch = Pitch }); tx.Flush(); tx.Close(); } } catch (IOException) { return; } if (File.Exists(DataFile)) File.Delete(DataFile); File.Move(file, DataFile); } } }
agpl-3.0
C#
bcb65e358494e1e29b2db472a25eb77664186af3
Add docs region for User class
GoogleCloudPlatform/getting-started-dotnet,GoogleCloudPlatform/getting-started-dotnet,GoogleCloudPlatform/getting-started-dotnet
aspnet/4-auth/Models/User.cs
aspnet/4-auth/Models/User.cs
// Copyright(c) 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not // use this file except in compliance with the License. You may obtain a copy of // the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the // License for the specific language governing permissions and limitations under // the License. using System.Security.Claims; using System.Security.Principal; namespace GoogleCloudSamples.Models { // [START user] public class User : ClaimsPrincipal { public User(IPrincipal principal) : base(principal as ClaimsPrincipal) { } public string Name => this.Identity.Name; public string UserId => this.FindFirst(ClaimTypes.NameIdentifier).Value; public string ProfileUrl => this.FindFirst(ClaimTypes.Uri).Value; } // [END user] }
// Copyright(c) 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not // use this file except in compliance with the License. You may obtain a copy of // the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the // License for the specific language governing permissions and limitations under // the License. using System.Security.Claims; using System.Security.Principal; namespace GoogleCloudSamples.Models { public class User : ClaimsPrincipal { public User(IPrincipal principal) : base(principal as ClaimsPrincipal) { } public string Name => this.Identity.Name; public string UserId => this.FindFirst(ClaimTypes.NameIdentifier).Value; public string ProfileUrl => this.FindFirst(ClaimTypes.Uri).Value; } }
apache-2.0
C#
13c1a9cdb8e6939a9222beda4dfbb7e847450d46
Fix broken licence header
ppy/osu-framework,smoogipooo/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,peppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework
osu.Framework.Tests/IO/FontStoreTest.cs
osu.Framework.Tests/IO/FontStoreTest.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.IO.Stores; namespace osu.Framework.Tests.IO { [TestFixture] public class FontStoreTest { private ResourceStore<byte[]> fontResourceStore; private TemporaryNativeStorage storage; [OneTimeSetUp] public void OneTimeSetUp() { storage = new TemporaryNativeStorage("fontstore-test"); fontResourceStore = new NamespacedResourceStore<byte[]>(new DllResourceStore(typeof(Drawable).Assembly.Location), "Resources.Fonts.OpenSans"); storage.GetFullPath("./", true); } [Test] public void TestNestedScaleAdjust() { var fontStore = new FontStore(new GlyphStore(fontResourceStore, "OpenSans") { CacheStorage = storage }, scaleAdjust: 100); var nestedFontStore = new FontStore(new GlyphStore(fontResourceStore, "OpenSans-Bold") { CacheStorage = storage }, 10); fontStore.AddStore(nestedFontStore); var normalGlyph = (FontStore.TexturedCharacterGlyph)fontStore.Get("OpenSans", 'a'); var boldGlyph = (FontStore.TexturedCharacterGlyph)fontStore.Get("OpenSans-Bold", 'a'); Assert.That(normalGlyph.ScaleAdjustment, Is.EqualTo(1f / 100)); Assert.That(boldGlyph.ScaleAdjustment, Is.EqualTo(1f / 10)); } [OneTimeTearDown] public void TearDown() { storage.Dispose(); } } }
// // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.IO.Stores; namespace osu.Framework.Tests.IO { [TestFixture] public class FontStoreTest { private ResourceStore<byte[]> fontResourceStore; private TemporaryNativeStorage storage; [OneTimeSetUp] public void OneTimeSetUp() { storage = new TemporaryNativeStorage("fontstore-test"); fontResourceStore = new NamespacedResourceStore<byte[]>(new DllResourceStore(typeof(Drawable).Assembly.Location), "Resources.Fonts.OpenSans"); storage.GetFullPath("./", true); } [Test] public void TestNestedScaleAdjust() { var fontStore = new FontStore(new GlyphStore(fontResourceStore, "OpenSans") { CacheStorage = storage }, scaleAdjust: 100); var nestedFontStore = new FontStore(new GlyphStore(fontResourceStore, "OpenSans-Bold") { CacheStorage = storage }, 10); fontStore.AddStore(nestedFontStore); var normalGlyph = (FontStore.TexturedCharacterGlyph)fontStore.Get("OpenSans", 'a'); var boldGlyph = (FontStore.TexturedCharacterGlyph)fontStore.Get("OpenSans-Bold", 'a'); Assert.That(normalGlyph.ScaleAdjustment, Is.EqualTo(1f / 100)); Assert.That(boldGlyph.ScaleAdjustment, Is.EqualTo(1f / 10)); } [OneTimeTearDown] public void TearDown() { storage.Dispose(); } } }
mit
C#
80e44a34603c8eefeb991f4920e29aa0440acbce
Update server test
synel/syndll2
Syndll2.Tests/BasicTests/ServerTests.cs
Syndll2.Tests/BasicTests/ServerTests.cs
using System; using System.Threading; using System.Threading.Tasks; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Syndll2.Tests.BasicTests { [TestClass] public class ServerTests { [TestMethod] //[Ignore] // run this manually, when appropriate public async Task Can_Receive_Inbound_Messages_From_Terminal() { var cts = new CancellationTokenSource(); var server = new SynelServer(); server.MessageReceived += (sender, args) => { var notification = args.Notification; if (notification.Type == NotificationType.Data) { Console.WriteLine(notification.Data); notification.Acknowledege(); } if (notification.Type == NotificationType.Query) { Console.WriteLine(notification.Data); notification.Reply(true, 0, "Success"); } cts.Cancel(); }; await server.ListenAsync(cts.Token); } } }
using System; using System.Threading; using System.Threading.Tasks; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Syndll2.Tests.BasicTests { [TestClass] public class ServerTests { [TestMethod] [Ignore] // run this manually, after enabling polling mode and recording some data public async Task Can_Receive_Inbound_Messages_From_Terminal() { var server = new SynelServer(); server.MessageReceived += (sender, args) => { var notification = args.Notification; if (notification.Type == NotificationType.Data) { Console.WriteLine(notification.Data); notification.Acknowledege(); } if (notification.Type == NotificationType.Query) { Console.WriteLine(notification.Data); notification.Reply(true, 0, "Success"); } }; var cts = new CancellationTokenSource(); server.ListenAsync(cts.Token).Wait(100000, cts.Token); } } }
mit
C#
546320fa79f395c936d3a6f3c3af7260a4ad5c02
Rename `Option` to `Opt` in key combination output
peppy/osu-framework,peppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,peppy/osu-framework,ppy/osu-framework
osu.Framework/Platform/MacOS/MacOSReadableKeyCombinationProvider.cs
osu.Framework/Platform/MacOS/MacOSReadableKeyCombinationProvider.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Input.Bindings; using osu.Framework.Platform.SDL2; using SDL2; namespace osu.Framework.Platform.MacOS { public class MacOSReadableKeyCombinationProvider : SDL2ReadableKeyCombinationProvider { protected override string GetReadableKey(InputKey key) { switch (key) { case InputKey.Super: return "Cmd"; case InputKey.Alt: return "Opt"; default: return base.GetReadableKey(key); } } protected override bool TryGetNameFromKeycode(SDL.SDL_Keycode keycode, out string name) { switch (keycode) { case SDL.SDL_Keycode.SDLK_LGUI: name = "LCmd"; return true; case SDL.SDL_Keycode.SDLK_RGUI: name = "RCmd"; return true; case SDL.SDL_Keycode.SDLK_LALT: name = "LOpt"; return true; case SDL.SDL_Keycode.SDLK_RALT: name = "ROpt"; return true; default: return base.TryGetNameFromKeycode(keycode, out name); } } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Input.Bindings; using osu.Framework.Platform.SDL2; using SDL2; namespace osu.Framework.Platform.MacOS { public class MacOSReadableKeyCombinationProvider : SDL2ReadableKeyCombinationProvider { protected override string GetReadableKey(InputKey key) { switch (key) { case InputKey.Super: return "Cmd"; case InputKey.Alt: return "Option"; default: return base.GetReadableKey(key); } } protected override bool TryGetNameFromKeycode(SDL.SDL_Keycode keycode, out string name) { switch (keycode) { case SDL.SDL_Keycode.SDLK_LGUI: name = "LCmd"; return true; case SDL.SDL_Keycode.SDLK_RGUI: name = "RCmd"; return true; case SDL.SDL_Keycode.SDLK_LALT: name = "LOption"; return true; case SDL.SDL_Keycode.SDLK_RALT: name = "ROption"; return true; default: return base.TryGetNameFromKeycode(keycode, out name); } } } }
mit
C#
d1fb31ca31f61f2c60c19b8f36b423a3d38a5f22
increment version
pudds/cfl-api.net,pudds/cfl-api.net
src/v1/Core/CurrentVersion.cs
src/v1/Core/CurrentVersion.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace mdryden.cflapi.v1 { public static class CurrentVersion { public const string Version = "1.24.0"; } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace mdryden.cflapi.v1 { public static class CurrentVersion { public const string Version = "1.9.0"; } }
mit
C#
330f8bbe7020f182d6979c50f51666e08b71bde9
Add module12
aloisdg/edx-csharp
edX/ModuleC/MainWindow.xaml.cs
edX/ModuleC/MainWindow.xaml.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace ModuleC { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void btnWriteFile_Click(object sender, RoutedEventArgs e) { WriteFile(); } private void btnReadFile_Click(object sender, RoutedEventArgs e) { ReadFile(); } public async void WriteFile() { string filePath = @"SampleFile.txt"; string text = txtContents.Text; await WriteTextAsync(filePath, text); } private Task WriteTextAsync(string filePath, string text) { byte[] encodedText = Encoding.Unicode.GetBytes(text); using (FileStream sourceStream = new FileStream(filePath, FileMode.Append, FileAccess.Write, FileShare.None, 4096, FileOptions.Asynchronous)) { return sourceStream.WriteAsync(encodedText, 0, encodedText.Length); } } public async void ReadFile() { string filePath = @"SampleFile.txt"; if (File.Exists(filePath) == false) { MessageBox.Show(filePath + " not found", "File Error", MessageBoxButton.OK); } else { try { string text = await ReadTextAsync(filePath); txtContents.Text = text; } catch (Exception ex) { Debug.WriteLine(ex.Message); } } } private async Task<string> ReadTextAsync(string filePath) { using (FileStream sourceStream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read, 4096, FileOptions.Asynchronous)) { StringBuilder sb = new StringBuilder(); byte[] buffer = new byte[0x1000]; int numRead; while ((numRead = await sourceStream.ReadAsync(buffer, 0, buffer.Length)) != 0) { string text = Encoding.Unicode.GetString(buffer, 0, numRead); sb.Append(text); } return sb.ToString(); } } } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace ModuleC { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void btnWriteFile_Click(object sender, RoutedEventArgs e) { WriteFile(); } private void btnReadFile_Click(object sender, RoutedEventArgs e) { ReadFile(); } public void WriteFile() { string filePath = @"SampleFile.txt"; string text = txtContents.Text; WriteText(filePath, text); } private void WriteText(string filePath, string text) { byte[] encodedText = Encoding.Unicode.GetBytes(text); using (FileStream sourceStream = new FileStream(filePath, FileMode.Append, FileAccess.Write, FileShare.None, bufferSize: 4096)) { sourceStream.Write(encodedText, 0, encodedText.Length); }; } public void ReadFile() { string filePath = @"SampleFile.txt"; if (File.Exists(filePath) == false) { MessageBox.Show(filePath + " not found", "File Error", MessageBoxButton.OK); } else { try { string text = ReadText(filePath); txtContents.Text = text; } catch (Exception ex) { Debug.WriteLine(ex.Message); } } } private string ReadText(string filePath) { using (FileStream sourceStream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read, bufferSize: 4096)) { StringBuilder sb = new StringBuilder(); byte[] buffer = new byte[0x1000]; int numRead; while ((numRead = sourceStream.Read(buffer, 0, buffer.Length)) != 0) { string text = Encoding.Unicode.GetString(buffer, 0, numRead); sb.Append(text); } return sb.ToString(); } } } }
mit
C#
970fdf493ed958652d4e333fa525bd3a7afa520b
Update description and version information
FelixINX/SpotifyStatusApplet,LPardue/SpotifyStatusApplet
SpotifyStatusApplet/Properties/AssemblyInfo.cs
SpotifyStatusApplet/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("SpotifyStatusApplet")] [assembly: AssemblyDescription("An LCD Applet for the Logitech Gaming keyboard family (G510, G13, G15 etc) that displays current track information and Spotify playback status.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Lucas Pardue")] [assembly: AssemblyProduct("SpotifyStatusApplet")] [assembly: AssemblyCopyright("Copyright © 2014. All Rights reserved.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("e9036c7a-2e63-46f5-9863-ad42ff0946b7")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.1.0.0")] [assembly: AssemblyFileVersion("1.1.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Spotify Status Applet")] [assembly: AssemblyDescription("Spotify Status Applet")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Spotify Status Applet")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("e9036c7a-2e63-46f5-9863-ad42ff0946b7")] // 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#
1110e1885e1c76a354aa0b542936063c02b7fcbd
Expand p tag on about screen.
jpfultonzm/trainingsandbox,jpfultonzm/trainingsandbox,jpfultonzm/trainingsandbox
ZirMed.TrainingSandbox/Views/Home/About.cshtml
ZirMed.TrainingSandbox/Views/Home/About.cshtml
@{ ViewBag.Title = "About"; } <h2>@ViewBag.Title.</h2> <h3>@ViewBag.Message</h3> <p>Use this area to provide additional information. Here is more groovy info.</p>
@{ ViewBag.Title = "About"; } <h2>@ViewBag.Title.</h2> <h3>@ViewBag.Message</h3> <p>Use this area to provide additional information.</p>
mit
C#
f340442fe5841346b9a73a60dd38ac71a4859885
Bump latest potential breaking change to 2.0.0
devlead/cake,gep13/cake,devlead/cake,cake-build/cake,patriksvensson/cake,gep13/cake,patriksvensson/cake,cake-build/cake
src/Cake.Core/Constants.cs
src/Cake.Core/Constants.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; namespace Cake.Core { internal static class Constants { public const ConsoleColor DefaultConsoleColor = (ConsoleColor)(-1); public static readonly Version LatestBreakingChange = new Version(0, 26, 0); public static readonly Version LatestPotentialBreakingChange = new Version(2, 0, 0); public static class Settings { public const string SkipVerification = "Settings_SkipVerification"; public const string SkipPackageVersionCheck = "Settings_SkipPackageVersionCheck"; public const string NoMonoCoersion = "Settings_NoMonoCoersion"; public const string ShowProcessCommandLine = "Settings_ShowProcessCommandLine"; } public static class Paths { public const string Tools = "Paths_Tools"; public const string Addins = "Paths_Addins"; public const string Modules = "Paths_Modules"; } } }
// 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; namespace Cake.Core { internal static class Constants { public const ConsoleColor DefaultConsoleColor = (ConsoleColor)(-1); public static readonly Version LatestBreakingChange = new Version(0, 26, 0); public static readonly Version LatestPotentialBreakingChange = new Version(1, 0, 0); public static class Settings { public const string SkipVerification = "Settings_SkipVerification"; public const string SkipPackageVersionCheck = "Settings_SkipPackageVersionCheck"; public const string NoMonoCoersion = "Settings_NoMonoCoersion"; public const string ShowProcessCommandLine = "Settings_ShowProcessCommandLine"; } public static class Paths { public const string Tools = "Paths_Tools"; public const string Addins = "Paths_Addins"; public const string Modules = "Paths_Modules"; } } }
mit
C#
04d91dcd4377386561b820e52daf1a426578cde0
Generalize Not on item type.
plioi/parsley
src/Parsley/Grammar.Not.cs
src/Parsley/Grammar.Not.cs
using System.Diagnostics.CodeAnalysis; namespace Parsley; partial class Grammar { /// <summary> /// The parser Not(p) succeeds when parser p fails, and fails /// when parser p succeeds. Not(p) never consumes input. /// </summary> public static Parser<TItem, Void> Not<TItem, TValue>(Parser<TItem, TValue> parse) { return (ReadOnlySpan<TItem> input, ref int index, [NotNullWhen(true)] out Void value, [NotNullWhen(false)] out string? expectation) => { value = Void.Value; var copyOfIndex = index; var succeeded = parse(input, ref copyOfIndex, out _, out expectation); if (succeeded) { expectation = "parse failure"; return false; } return true; }; } }
using System.Diagnostics.CodeAnalysis; namespace Parsley; partial class Grammar { /// <summary> /// The parser Not(p) succeeds when parser p fails, and fails /// when parser p succeeds. Not(p) never consumes input. /// </summary> public static Parser<char, Void> Not<TValue>(Parser<char, TValue> parse) { return (ReadOnlySpan<char> input, ref int index, [NotNullWhen(true)] out Void value, [NotNullWhen(false)] out string? expectation) => { value = Void.Value; var copyOfIndex = index; var succeeded = parse(input, ref copyOfIndex, out _, out expectation); if (succeeded) { expectation = "parse failure"; return false; } return true; }; } }
mit
C#
7af2048de4e0a0899eaa41f7cb78f05f44a12ff6
hide messages in VS from internal analyzer
bkoelman/CSharpGuidelinesAnalyzer
src/CSharpGuidelinesAnalyzer/CSharpGuidelinesAnalyzer/Rules/OperationIsStatementAnalyzer.cs
src/CSharpGuidelinesAnalyzer/CSharpGuidelinesAnalyzer/Rules/OperationIsStatementAnalyzer.cs
#if DEBUG using System; using System.Collections.Immutable; using CSharpGuidelinesAnalyzer.Extensions; using JetBrains.Annotations; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Text; namespace CSharpGuidelinesAnalyzer.Rules { [DiagnosticAnalyzer(LanguageNames.CSharp)] public sealed class OperationIsStatementAnalyzer : GuidelineAnalyzer { public const string DiagnosticId = "AV1000"; private const string Title = "Operation should be a statement"; private const string TypeMessageFormat = "Operation '{0}' should be a statement"; private const string Description = "Operation should be a statement."; [NotNull] private static readonly AnalyzerCategory Category = AnalyzerCategory.Framework; [NotNull] private static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticId, Title, TypeMessageFormat, Category.Name, DiagnosticSeverity.Hidden, true, Description, Category.GetHelpLinkUri(DiagnosticId)); [ItemNotNull] public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(Rule); public override void Initialize([NotNull] AnalysisContext context) { context.EnableConcurrentExecution(); context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None); context.RegisterOperationAction(AnalyzeOperation, (OperationKind[])Enum.GetValues(typeof(OperationKind))); } private void AnalyzeOperation(OperationAnalysisContext context) { if (!context.Operation.IsImplicit && context.Operation.IsStatement()) { Location locationForKeyword = context.Operation.GetLocationForKeyword(); Location location = locationForKeyword ?? context.Operation.Syntax.GetLocation(); string keywordText = GetTextAt(location); context.ReportDiagnostic(Diagnostic.Create(Rule, location, keywordText)); } } [NotNull] private static string GetTextAt([NotNull] Location locationForKeyword) { TextSpan sourceSpan = locationForKeyword.SourceSpan; return locationForKeyword.SourceTree.ToString().Substring(sourceSpan.Start, sourceSpan.Length); } } } #endif
#if DEBUG using System; using System.Collections.Immutable; using CSharpGuidelinesAnalyzer.Extensions; using JetBrains.Annotations; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Text; namespace CSharpGuidelinesAnalyzer.Rules { [DiagnosticAnalyzer(LanguageNames.CSharp)] public sealed class OperationIsStatementAnalyzer : GuidelineAnalyzer { public const string DiagnosticId = "AV1000"; private const string Title = "Operation should be a statement"; private const string TypeMessageFormat = "Operation '{0}' should be a statement"; private const string Description = "Operation should be a statement."; [NotNull] private static readonly AnalyzerCategory Category = AnalyzerCategory.Framework; [NotNull] private static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticId, Title, TypeMessageFormat, Category.Name, DiagnosticSeverity.Info, true, Description, Category.GetHelpLinkUri(DiagnosticId)); [ItemNotNull] public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(Rule); public override void Initialize([NotNull] AnalysisContext context) { context.EnableConcurrentExecution(); context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None); context.RegisterOperationAction(AnalyzeOperation, (OperationKind[])Enum.GetValues(typeof(OperationKind))); } private void AnalyzeOperation(OperationAnalysisContext context) { if (!context.Operation.IsImplicit && context.Operation.IsStatement()) { Location locationForKeyword = context.Operation.GetLocationForKeyword(); Location location = locationForKeyword ?? context.Operation.Syntax.GetLocation(); string keywordText = GetTextAt(location); context.ReportDiagnostic(Diagnostic.Create(Rule, location, keywordText)); } } [NotNull] private static string GetTextAt([NotNull] Location locationForKeyword) { TextSpan sourceSpan = locationForKeyword.SourceSpan; return locationForKeyword.SourceTree.ToString().Substring(sourceSpan.Start, sourceSpan.Length); } } } #endif
apache-2.0
C#
9a3902ef8983064d3eba68c671b25c6160a0a593
remove useless
JetBrains/resharper-unity,JetBrains/resharper-unity,JetBrains/resharper-unity
resharper/resharper-unity/src/CSharp/Daemon/Stages/BurstCodeAnalysis/Analyzers/Rider/BurstCodeInsightProvider.cs
resharper/resharper-unity/src/CSharp/Daemon/Stages/BurstCodeAnalysis/Analyzers/Rider/BurstCodeInsightProvider.cs
using System.Collections.Generic; using JetBrains.Application.UI.Controls.GotoByName; using JetBrains.Collections.Viewable; using JetBrains.ProjectModel; using JetBrains.ReSharper.Host.Features.CodeInsights.Providers; using JetBrains.ReSharper.Plugins.Unity.ProjectModel; using JetBrains.ReSharper.Plugins.Unity.Rider.CodeInsights; using JetBrains.ReSharper.Plugins.Unity.Rider.Protocol; using JetBrains.Rider.Model; namespace JetBrains.ReSharper.Plugins.Unity.CSharp.Daemon.Stages.BurstCodeAnalysis.Analyzers.Rider { [SolutionComponent] public class BurstCodeInsightProvider : AbstractUnityCodeInsightProvider { public BurstCodeInsightProvider(FrontendBackendHost frontendBackendHost, BulbMenuComponent bulbMenu, UnitySolutionTracker tracker) : base(frontendBackendHost, bulbMenu) { RelativeOrderings = tracker.IsUnityProject.HasTrueValue() ? new CodeLensRelativeOrdering[] {new CodeLensRelativeOrderingBefore(ReferencesCodeInsightsProvider.Id)} : new CodeLensRelativeOrdering[] {new CodeLensRelativeOrderingLast()}; } public override string ProviderId => BurstCodeAnalysisUtil.BURST_DISPLAY_NAME; public override string DisplayName => BurstCodeAnalysisUtil.BURST_DISPLAY_NAME; public override CodeLensAnchorKind DefaultAnchor => CodeLensAnchorKind.Top; public override ICollection<CodeLensRelativeOrdering> RelativeOrderings { get; } } }
using System.Collections.Generic; using JetBrains.Application.UI.Controls.GotoByName; using JetBrains.Collections.Viewable; using JetBrains.ProjectModel; using JetBrains.ReSharper.Host.Features.CodeInsights.Providers; using JetBrains.ReSharper.Plugins.Unity.ProjectModel; using JetBrains.ReSharper.Plugins.Unity.Rider.CodeInsights; using JetBrains.ReSharper.Plugins.Unity.Rider.Protocol; using JetBrains.Rider.Model; namespace JetBrains.ReSharper.Plugins.Unity.CSharp.Daemon.Stages.BurstCodeAnalysis.Analyzers.Rider { [SolutionComponent] public class BurstCodeInsightProvider : AbstractUnityCodeInsightProvider { public BurstCodeInsightProvider(FrontendBackendHost frontendBackendHost, UnitySolutionTracker solutionTracker, BulbMenuComponent bulbMenu, UnitySolutionTracker tracker) : base(frontendBackendHost, bulbMenu) { RelativeOrderings = tracker.IsUnityProject.HasTrueValue() // CGTD with performance critical ? new CodeLensRelativeOrdering[] {new CodeLensRelativeOrderingBefore(ReferencesCodeInsightsProvider.Id)} : new CodeLensRelativeOrdering[] {new CodeLensRelativeOrderingLast()}; } public override string ProviderId => BurstCodeAnalysisUtil.BURST_DISPLAY_NAME; public override string DisplayName => BurstCodeAnalysisUtil.BURST_DISPLAY_NAME; public override CodeLensAnchorKind DefaultAnchor => CodeLensAnchorKind.Top; public override ICollection<CodeLensRelativeOrdering> RelativeOrderings { get; } } }
apache-2.0
C#
c9f0890b1352a853c924a7dcedda63490a41c0f4
Return generic definitions last for ContravariantFilter
Miruken-DotNet/Miruken
Source/Miruken.Castle/ContravariantFilter.cs
Source/Miruken.Castle/ContravariantFilter.cs
namespace Miruken.Castle { using System; using System.Linq; using System.Reflection; using global::Castle.MicroKernel; public class ContravariantFilter : IHandlersFilter { public bool HasOpinionAbout(Type service) { if (!service.IsGenericType) return false; var genericType = service.GetGenericTypeDefinition(); var genericArguments = genericType.GetGenericArguments(); return genericArguments.Count(arg => arg.GenericParameterAttributes .HasFlag(GenericParameterAttributes.Contravariant)) == 1; } public IHandler[] SelectHandlers(Type service, IHandler[] handlers) { return handlers.OrderBy(h => h.ComponentModel.Implementation.IsGenericTypeDefinition ? 1 : 0) .ToArray(); } } }
namespace Miruken.Castle { using System; using System.Linq; using System.Reflection; using global::Castle.MicroKernel; public class ContravariantFilter : IHandlersFilter { public bool HasOpinionAbout(Type service) { if (!service.IsGenericType) return false; var genericType = service.GetGenericTypeDefinition(); var genericArguments = genericType.GetGenericArguments(); return genericArguments.Count(arg => arg.GenericParameterAttributes .HasFlag(GenericParameterAttributes.Contravariant)) == 1; } public IHandler[] SelectHandlers(Type service, IHandler[] handlers) { return handlers // prefer concrete handlers .Where(h => !h.ComponentModel.Implementation.IsGenericTypeDefinition) .ToArray(); } } }
mit
C#
f9c2a9bc0c58c1a297035dc2960cbf6ac07456f6
Use delegate type name to distinguish Action<> from Func<>
sergeyshushlyapin/AutoFixture,dcastro/AutoFixture,AutoFixture/AutoFixture,sean-gilliam/AutoFixture,sergeyshushlyapin/AutoFixture,sbrockway/AutoFixture,dcastro/AutoFixture,sbrockway/AutoFixture,adamchester/AutoFixture,zvirja/AutoFixture,Pvlerick/AutoFixture,adamchester/AutoFixture
Src/AutoFixture/LambdaExpressionGenerator.cs
Src/AutoFixture/LambdaExpressionGenerator.cs
namespace Ploeh.AutoFixture { using System; using System.Linq; using System.Linq.Expressions; using Kernel; /// <summary> /// Creates new lambda expressions represented by the <see cref="Expression{TDelegate}"/> type. /// </summary> /// <remarks> /// Specimens are typically either of type <see> /// <cref>Expression{Func{T}}</cref> /// </see> /// or <see cref="Expression{Action}"/>. /// </remarks> public class LambdaExpressionGenerator : ISpecimenBuilder { /// <summary> /// Creates a new lambda expression represented by the <see cref="Expression{TDelegate}"/> type. /// </summary> /// <param name="request">The request that describes what to create.</param> /// <param name="context">Not used.</param> /// <returns> /// A new <see cref="Expression{TDelegate}"/> instance, if <paramref name="request"/> is a request for a /// <see cref="Expression{TDelegate}"/>; otherwise, a <see cref="NoSpecimen"/> instance. /// </returns> public object Create(object request, ISpecimenContext context) { var requestType = request as Type; if (requestType == null) { return new NoSpecimen(); } if (requestType.BaseType != typeof(LambdaExpression)) { return new NoSpecimen(); } var delegateType = requestType.GetGenericArguments().Single(); var genericArguments = delegateType.GetGenericArguments().Select(Expression.Parameter).ToList(); if (delegateType == typeof(Action)) { return Expression.Lambda(Expression.Empty()); } if (delegateType.FullName.StartsWith("System.Action`", StringComparison.Ordinal)) { return Expression.Lambda(Expression.Empty(), genericArguments); } var body = genericArguments.Last(); var parameters = genericArguments.Except(new[] { body }); return Expression.Lambda(body, parameters); } } }
namespace Ploeh.AutoFixture { using System; using System.Linq; using System.Linq.Expressions; using Kernel; /// <summary> /// Creates new lambda expressions represented by the <see cref="Expression{TDelegate}"/> type. /// </summary> /// <remarks> /// Specimens are typically either of type <see> /// <cref>Expression{Func{T}}</cref> /// </see> /// or <see cref="Expression{Action}"/>. /// </remarks> public class LambdaExpressionGenerator : ISpecimenBuilder { /// <summary> /// Creates a new lambda expression represented by the <see cref="Expression{TDelegate}"/> type. /// </summary> /// <param name="request">The request that describes what to create.</param> /// <param name="context">Not used.</param> /// <returns> /// A new <see cref="Expression{TDelegate}"/> instance, if <paramref name="request"/> is a request for a /// <see cref="Expression{TDelegate}"/>; otherwise, a <see cref="NoSpecimen"/> instance. /// </returns> public object Create(object request, ISpecimenContext context) { var requestType = request as Type; if (requestType == null) { return new NoSpecimen(); } if (requestType.BaseType != typeof(LambdaExpression)) { return new NoSpecimen(); } var delegateType = requestType.GetGenericArguments().Single(); var genericArguments = delegateType.GetGenericArguments().Select(Expression.Parameter).ToList(); if (delegateType.Name.StartsWith("Action")) { return Expression.Lambda(Expression.Empty(), genericArguments); } var body = genericArguments.Last(); var parameters = genericArguments.Except(new[] { body }); return Expression.Lambda(body, parameters); } } }
mit
C#
53466b37c216e0d91d57ef544d96604b6dd18fdd
Add filter property to most watched shows request.
henrikfroehling/TraktApiSharp
Source/Lib/TraktApiSharp/Requests/WithoutOAuth/Shows/Common/TraktShowsMostWatchedRequest.cs
Source/Lib/TraktApiSharp/Requests/WithoutOAuth/Shows/Common/TraktShowsMostWatchedRequest.cs
namespace TraktApiSharp.Requests.WithoutOAuth.Shows.Common { using Base; using Base.Get; using Enums; using Objects.Basic; using Objects.Get.Shows.Common; using System.Collections.Generic; internal class TraktShowsMostWatchedRequest : TraktGetRequest<TraktPaginationListResult<TraktMostWatchedShow>, TraktMostWatchedShow> { internal TraktShowsMostWatchedRequest(TraktClient client) : base(client) { Period = TraktPeriod.Weekly; } internal TraktPeriod? Period { get; set; } protected override IDictionary<string, object> GetUriPathParameters() { var uriParams = base.GetUriPathParameters(); if (Period.HasValue && Period.Value != TraktPeriod.Unspecified) uriParams.Add("period", Period.Value.AsString()); return uriParams; } protected override string UriTemplate => "shows/watched{/period}{?extended,page,limit,query,years,genres,languages,countries,runtimes,ratings,certifications,networks,status}"; protected override TraktAuthorizationRequirement AuthorizationRequirement => TraktAuthorizationRequirement.NotRequired; internal TraktShowFilter Filter { get; set; } protected override bool SupportsPagination => true; protected override bool IsListResult => true; } }
namespace TraktApiSharp.Requests.WithoutOAuth.Shows.Common { using Base.Get; using Enums; using Objects.Basic; using Objects.Get.Shows.Common; using System.Collections.Generic; internal class TraktShowsMostWatchedRequest : TraktGetRequest<TraktPaginationListResult<TraktMostWatchedShow>, TraktMostWatchedShow> { internal TraktShowsMostWatchedRequest(TraktClient client) : base(client) { Period = TraktPeriod.Weekly; } internal TraktPeriod? Period { get; set; } protected override IDictionary<string, object> GetUriPathParameters() { var uriParams = base.GetUriPathParameters(); if (Period.HasValue && Period.Value != TraktPeriod.Unspecified) uriParams.Add("period", Period.Value.AsString()); return uriParams; } protected override string UriTemplate => "shows/watched{/period}{?extended,page,limit}"; protected override TraktAuthorizationRequirement AuthorizationRequirement => TraktAuthorizationRequirement.NotRequired; protected override bool SupportsPagination => true; protected override bool IsListResult => true; } }
mit
C#
17bf8530df99d10fc61fc52f3da33267f962544c
fix divide by zero
depp/morning-ritual
MorningRitual/Assets/Scripts/CameraMovement.cs
MorningRitual/Assets/Scripts/CameraMovement.cs
using UnityEngine; using System.Collections; public class CameraMovement : MonoBehaviour { public delegate void Action(); bool ismoving = false; private Vector3 nextCameraPosition; private Vector3 cameraStart; public float speed = 30.0f; public float smoothing = 1.0f; private float startTime; private float deltaTime; private Action callback; // Update is called once per frame void Update () { if (ismoving) { float t = deltaTime > 1e-3 ? (Time.time - startTime) / deltaTime : 1.0f; if (t >= 1) { ismoving = false; Camera.main.transform.position = nextCameraPosition; this.callback (); } else { t = t * (1 - smoothing) + (0.5f - 0.5f * Mathf.Cos(t * Mathf.PI)) * smoothing; Camera.main.transform.position = Vector3.Lerp (cameraStart, nextCameraPosition, t); } } } public void MoveTo(Vector3 target, Action callback) { ismoving = true; nextCameraPosition = target; cameraStart = Camera.main.transform.position; float dist = Vector3.Distance(cameraStart, nextCameraPosition); startTime = Time.time; deltaTime = dist / speed; this.callback = callback; } }
using UnityEngine; using System.Collections; public class CameraMovement : MonoBehaviour { public delegate void Action(); bool ismoving = false; private Vector3 nextCameraPosition; private Vector3 cameraStart; public float speed = 30.0f; public float smoothing = 1.0f; private float startTime; private float deltaTime; private Action callback; // Update is called once per frame void Update () { if (ismoving) { float t = (Time.time - startTime) / deltaTime; if (t >= 1) { ismoving = false; Camera.main.transform.position = nextCameraPosition; this.callback (); } else { t = t * (1 - smoothing) + (0.5f - 0.5f * Mathf.Cos(t * Mathf.PI)) * smoothing; Camera.main.transform.position = Vector3.Lerp (cameraStart, nextCameraPosition, t); } } } public void MoveTo(Vector3 target, Action callback) { ismoving = true; nextCameraPosition = target; cameraStart = Camera.main.transform.position; float dist = Vector3.Distance(cameraStart, nextCameraPosition); startTime = Time.time; deltaTime = dist / speed; this.callback = callback; } }
mit
C#
9d5b6947c0ee9ade786889a00f4e7ee50264a42b
Change the name of MessageWithLayout property
harouny/NLog.Extensions.AzureTableStorage
NLog.Extensions.AzureTableStorage/LogEntity.cs
NLog.Extensions.AzureTableStorage/LogEntity.cs
using System.Globalization; using System.Linq; using Microsoft.WindowsAzure.Storage.Table; namespace NLog.Extensions.AzureTableStorage { public class LogEntity : TableEntity { public LogEntity(LogEventInfo logEvent, string layoutMessage) { LoggerName = logEvent.LoggerName; LogTimeStamp = logEvent.TimeStamp.ToString(CultureInfo.InvariantCulture); Level = logEvent.Level.Name; Message = logEvent.FormattedMessage; MessageWithLayout = layoutMessage; if (logEvent.Exception != null) { Exception = logEvent.Exception.ToString(); if (logEvent.Exception.InnerException != null) { InnerException = logEvent.Exception.ToString(); } } if (logEvent.Parameters != null) { Parameters = logEvent.Parameters .Select(o => o.ToString()) .Aggregate((o, o1) => (o == null ? "Null" : o.ToString(CultureInfo.InvariantCulture)) + " , " + (o1 == null ? "Null" : o1.ToString(CultureInfo.InvariantCulture))); } if (logEvent.StackTrace != null) { StackTrace = logEvent.StackTrace.ToString(); } RowKey = LoggerName + "-" + logEvent.TimeStamp.Ticks; PartitionKey = LoggerName; } public LogEntity() { } public string LogTimeStamp { get; set; } public string Level { get; set; } public string LoggerName { get; set; } public string Message { get; set; } public string Exception { get; set; } public string InnerException { get; set; } public string Parameters { get; set; } public string StackTrace { get; set; } public string MessageWithLayout { get; set; } } }
using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.WindowsAzure.Storage.Table; namespace NLog.Extensions.AzureTableStorage { public class LogEntity : TableEntity { public LogEntity(LogEventInfo logEvent, string layoutMessage) { LoggerName = logEvent.LoggerName; LogTimeStamp = logEvent.TimeStamp.ToString(CultureInfo.InvariantCulture); Level = logEvent.Level.Name; Message = logEvent.FormattedMessage; LayoutMessage = layoutMessage; if (logEvent.Exception != null) { Exception = logEvent.Exception.ToString(); if (logEvent.Exception.InnerException != null) { InnerException = logEvent.Exception.ToString(); } } if (logEvent.Parameters != null) { Parameters = logEvent.Parameters .Select(o => o.ToString()) .Aggregate((o, o1) => (o == null ? "Null" : o.ToString(CultureInfo.InvariantCulture)) + " , " + (o1 == null ? "Null" : o1.ToString(CultureInfo.InvariantCulture))); } if (logEvent.StackTrace != null) { StackTrace = logEvent.StackTrace.ToString(); } RowKey = LoggerName + "-" + logEvent.TimeStamp.Ticks; PartitionKey = LoggerName; } public LogEntity() { } public string LogTimeStamp { get; set; } public string Level { get; set; } public string LoggerName { get; set; } public string Message { get; set; } public string Exception { get; set; } public string InnerException { get; set; } public string Parameters { get; set; } public string StackTrace { get; set; } public string LayoutMessage { get; set; } } }
mit
C#
e6ec730aef7076d3527432143a3e7eb3f2e452c4
Remove ReferenceTableReferenceTable test in regular cache
villermen/runescape-cache-tools,villermen/runescape-cache-tools
RuneScapeCacheToolsTests/RuneTek5CacheTests.cs
RuneScapeCacheToolsTests/RuneTek5CacheTests.cs
using RuneScapeCacheToolsTests.Fixtures; using Villermen.RuneScapeCacheTools.Cache; using Villermen.RuneScapeCacheTools.Cache.RuneTek5; using Xunit; using Xunit.Abstractions; namespace RuneScapeCacheToolsTests { [Collection("TestCache")] public class RuneTek5CacheTests { private ITestOutputHelper Output { get; } private CacheFixture Fixture { get; } public RuneTek5CacheTests(ITestOutputHelper output, CacheFixture fixture) { Output = output; Fixture = fixture; } /// <summary> /// Test for a file that exists, an archive file that exists and a file that doesn't exist. /// </summary> [Fact] public void TestGetFile() { var file = Fixture.RuneTek5Cache.GetFile(12, 3); var fileData = file.Data; Assert.True(fileData.Length > 0, "File's data is empty."); var archiveFile = Fixture.RuneTek5Cache.GetFile(17, 5); var archiveEntry = archiveFile.Entries[255]; Assert.True(archiveEntry.Length > 0, "Archive entry's data is empty."); try { Fixture.RuneTek5Cache.GetFile(40, 30); Assert.True(false, "Cache returned a file that shouldn't exist."); } catch (CacheException exception) { Assert.True(exception.Message.Contains("incomplete"), "Non-existent file cache exception had the wrong message."); } } [Fact] public void TestGetReferenceTable() { var referenceTable40 = Fixture.RuneTek5Cache.GetReferenceTable(40); var referenceTable17 = Fixture.RuneTek5Cache.GetReferenceTable(17); var referenceTable12 = Fixture.RuneTek5Cache.GetReferenceTable(12); } } }
using RuneScapeCacheToolsTests.Fixtures; using Villermen.RuneScapeCacheTools.Cache; using Villermen.RuneScapeCacheTools.Cache.RuneTek5; using Xunit; using Xunit.Abstractions; namespace RuneScapeCacheToolsTests { [Collection("TestCache")] public class RuneTek5CacheTests { private ITestOutputHelper Output { get; } private CacheFixture Fixture { get; } public RuneTek5CacheTests(ITestOutputHelper output, CacheFixture fixture) { Output = output; Fixture = fixture; } /// <summary> /// Test for a file that exists, an archive file that exists and a file that doesn't exist. /// </summary> [Fact] public void TestGetFile() { var file = Fixture.RuneTek5Cache.GetFile(12, 3); var fileData = file.Data; Assert.True(fileData.Length > 0, "File's data is empty."); var archiveFile = Fixture.RuneTek5Cache.GetFile(17, 5); var archiveEntry = archiveFile.Entries[255]; Assert.True(archiveEntry.Length > 0, "Archive entry's data is empty."); try { Fixture.RuneTek5Cache.GetFile(40, 30); Assert.True(false, "Cache returned a file that shouldn't exist."); } catch (CacheException exception) { Assert.True(exception.Message.Contains("incomplete"), "Non-existent file cache exception had the wrong message."); } } [Fact] public void TestGetReferenceTable() { var referenceTable40 = Fixture.RuneTek5Cache.GetReferenceTable(40); var referenceTable17 = Fixture.RuneTek5Cache.GetReferenceTable(17); var referenceTable12 = Fixture.RuneTek5Cache.GetReferenceTable(12); } [Fact(Skip = "Not implemented")] public void TestGetReferenceTableReferenceTable() { Fixture.RuneTek5Cache.GetReferenceTable(RuneTek5Cache.MetadataIndexId); } } }
mit
C#
3fa9aa79aac34b95cabb7f965751cd69c393dfdb
Set tooltip text on initial load
DMagic1/KSP_Contract_Window
Source/ContractsWindow.Unity/TooltipHandler.cs
Source/ContractsWindow.Unity/TooltipHandler.cs
#region license /*The MIT License (MIT) TooltipHandler - Script to control tooltip activation Copyright (c) 2016 DMagic Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #endregion using System; using System.Collections.Generic; using ContractsWindow.Unity.Unity; using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; namespace ContractsWindow.Unity { public class TooltipHandler : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IPointerClickHandler, IScrollHandler { [SerializeField, TextArea(2, 10)] private string Text = ""; private bool isActive = true; private ToolTip tooltip; private void Start() { if (CW_Window.Window == null) return; if (CW_Window.Window.Tooltip == null) return; if (CW_Window.Window.Interface == null) return; if (CW_Window.Window.Interface.MainCanvas == null) return; if (string.IsNullOrEmpty(Text)) return; GameObject obj = Instantiate(CW_Window.Window.Tooltip); if (obj == null) return; obj.transform.SetParent(CW_Window.Window.Interface.MainCanvas.transform, false); tooltip = obj.GetComponent<ToolTip>(); tooltip.SetTooltip(Text); tooltip.HideTooltip(); } public void SetNewText(string s) { Text = s; } public bool IsActive { set { isActive = value; } } public void OnPointerEnter(PointerEventData eventData) { if (tooltip == null) return; if (!isActive) return; tooltip.SetTooltip(Text); } public void OnPointerExit(PointerEventData eventData) { if (tooltip == null) return; tooltip.HideTooltip(); } public void OnPointerClick(PointerEventData eventData) { if (tooltip == null) return; tooltip.HideTooltip(); } public void OnScroll(PointerEventData eventData) { if (CW_Window.Window == null) return; if (CW_Window.Window.Scroll == null) return; CW_Window.Window.Scroll.OnScroll(eventData); } } }
#region license /*The MIT License (MIT) TooltipHandler - Script to control tooltip activation Copyright (c) 2016 DMagic Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #endregion using System; using System.Collections.Generic; using ContractsWindow.Unity.Unity; using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; namespace ContractsWindow.Unity { public class TooltipHandler : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IPointerClickHandler, IScrollHandler { [SerializeField, TextArea(2, 10)] private string Text = ""; private bool isActive = true; private ToolTip tooltip; private void Start() { if (CW_Window.Window == null) return; if (CW_Window.Window.Tooltip == null) return; if (CW_Window.Window.Interface == null) return; if (CW_Window.Window.Interface.MainCanvas == null) return; if (string.IsNullOrEmpty(Text)) return; GameObject obj = Instantiate(CW_Window.Window.Tooltip); if (obj == null) return; obj.transform.SetParent(CW_Window.Window.Interface.MainCanvas.transform, false); tooltip = obj.GetComponent<ToolTip>(); } public void SetNewText(string s) { Text = s; } public bool IsActive { set { isActive = value; } } public void OnPointerEnter(PointerEventData eventData) { if (tooltip == null) return; if (!isActive) return; tooltip.SetTooltip(Text); } public void OnPointerExit(PointerEventData eventData) { if (tooltip == null) return; tooltip.HideTooltip(); } public void OnPointerClick(PointerEventData eventData) { if (tooltip == null) return; tooltip.HideTooltip(); } public void OnScroll(PointerEventData eventData) { if (CW_Window.Window == null) return; if (CW_Window.Window.Scroll == null) return; CW_Window.Window.Scroll.OnScroll(eventData); } } }
mit
C#
25f8630ddc7f2bbd4ad46d377e565f78b217ae42
Make "scopes" required, closes #2497
RSuter/NSwag,RSuter/NSwag,RSuter/NSwag,quails4Eva/NSwag,quails4Eva/NSwag,quails4Eva/NSwag,quails4Eva/NSwag,RSuter/NSwag,RSuter/NSwag
src/NSwag.Core/OpenApiOAuthFlow.cs
src/NSwag.Core/OpenApiOAuthFlow.cs
//----------------------------------------------------------------------- // <copyright file="SwaggerSecurityScheme.cs" company="NSwag"> // Copyright (c) Rico Suter. All rights reserved. // </copyright> // <license>https://github.com/RicoSuter/NSwag/blob/master/LICENSE.md</license> // <author>Rico Suter, mail@rsuter.com</author> //----------------------------------------------------------------------- using System.Collections.Generic; using Newtonsoft.Json; namespace NSwag { /// <summary>Configuration for an OAuth flow.</summary> public class OpenApiOAuthFlow { /// <summary>Gets or sets the authorization URL to be used for this flow.</summary> [JsonProperty(PropertyName = "authorizationUrl", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)] public string AuthorizationUrl { get; set; } /// <summary>Gets or sets the token URL to be used for this flow.</summary> [JsonProperty(PropertyName = "tokenUrl", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)] public string TokenUrl { get; set; } /// <summary>Gets or sets the token URL to be used for this flow.</summary> [JsonProperty(PropertyName = "refreshUrl", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)] public string RefreshUrl { get; set; } /// <summary>Gets the available scopes for the OAuth2 security scheme.</summary> [JsonProperty(PropertyName = "scopes", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate, Required = Required.Always)] public IDictionary<string, string> Scopes { get; set; } = new Dictionary<string, string>(); } }
//----------------------------------------------------------------------- // <copyright file="SwaggerSecurityScheme.cs" company="NSwag"> // Copyright (c) Rico Suter. All rights reserved. // </copyright> // <license>https://github.com/RicoSuter/NSwag/blob/master/LICENSE.md</license> // <author>Rico Suter, mail@rsuter.com</author> //----------------------------------------------------------------------- using System.Collections.Generic; using Newtonsoft.Json; namespace NSwag { /// <summary>Configuration for an OAuth flow.</summary> public class OpenApiOAuthFlow { /// <summary>Gets or sets the authorization URL to be used for this flow.</summary> [JsonProperty(PropertyName = "authorizationUrl", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)] public string AuthorizationUrl { get; set; } /// <summary>Gets or sets the token URL to be used for this flow.</summary> [JsonProperty(PropertyName = "tokenUrl", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)] public string TokenUrl { get; set; } /// <summary>Gets or sets the token URL to be used for this flow.</summary> [JsonProperty(PropertyName = "refreshUrl", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)] public string RefreshUrl { get; set; } /// <summary>Gets the available scopes for the OAuth2 security scheme.</summary> [JsonProperty(PropertyName = "scopes", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)] public IDictionary<string, string> Scopes { get; set; } = new Dictionary<string, string>(); } }
mit
C#
13626244ce09c6e4f8e063cea32bffcb6e487672
Add async/await based pattern execution
peterblazejewicz/azure-aspnet5-examples,peterblazejewicz/azure-aspnet5-examples
src/QueueGettingStarted/Program.cs
src/QueueGettingStarted/Program.cs
using System; using Microsoft.WindowsAzure.Storage; using Microsoft.WindowsAzure.Storage.Queue; using Microsoft.Extensions.Configuration; using System.Diagnostics; using System.Threading.Tasks; namespace QueueGettingStarted { public class Program { public static void Main(string[] args) { AsyncTask(args) .ContinueWith((task) => { Console.WriteLine("Press any key to exit..."); Console.ReadKey(); }).Wait(); } public async static Task AsyncTask(string[] args) { // configuration var builder = new ConfigurationBuilder() .AddJsonFile("./appsettings.json") .AddUserSecrets() .AddEnvironmentVariables(); Configuration = builder.Build(); // options ConfigurationBinder.Bind(Configuration.GetSection("Azure:Storage"), Options); Console.WriteLine("Queue encryption sample"); Console.WriteLine($"Configuration for ConnectionString: {Options.ConnectionString}"); CloudStorageAccount storageAccount = CloudStorageAccount.Parse(Options.ConnectionString); CloudQueueClient client = storageAccount.CreateCloudQueueClient(); Debug.Assert(client != null, "Client created"); string hash = Guid.NewGuid().ToString("N"); CloudQueue queue = client.GetQueueReference($"{Options.DemoQueue}{hash}"); try { await queue.CreateAsync(); } finally { bool deleted = await queue.DeleteIfExistsAsync(); Console.WriteLine($"Queue deleted: {deleted}"); } } static IConfiguration Configuration { get; set; } static AzureStorageOptions Options { get; set; } = new AzureStorageOptions(); } class AzureStorageOptions { public string ConnectionString { get; set; } public string DemoQueue { get; set; } } }
using System; using Microsoft.WindowsAzure.Storage; using Microsoft.WindowsAzure.Storage.Queue; using Microsoft.Extensions.Configuration; using System.Diagnostics; namespace QueueGettingStarted { public class Program { public static void Main(string[] args) { // configuration var builder = new ConfigurationBuilder() .AddJsonFile("./appsettings.json") .AddUserSecrets() .AddEnvironmentVariables(); Configuration = builder.Build(); // options ConfigurationBinder.Bind(Configuration.GetSection("Azure:Storage"), Options); Console.WriteLine("Queue encryption sample"); Console.WriteLine($"Configuration for ConnectionString: {Options.ConnectionString}"); CloudStorageAccount storageAccount = CloudStorageAccount.Parse(Options.ConnectionString); CloudQueueClient client = storageAccount.CreateCloudQueueClient(); Debug.Assert(client != null, "Client created"); Console.WriteLine("Client created"); Console.WriteLine($"queue: {Options.DemoQueue}"); Console.ReadKey(); } static IConfiguration Configuration { get; set; } static AzureStorageOptions Options { get; set; } = new AzureStorageOptions(); } class AzureStorageOptions { public string ConnectionString { get; set; } public string DemoQueue { get; set; } } }
mit
C#
d104dccf3ebbac10677a44a58d3937d140b310bf
Fix runner_util paths
heejaechang/roslyn,AnthonyDGreen/roslyn,michalhosala/roslyn,wvdd007/roslyn,AArnott/roslyn,bartdesmet/roslyn,jasonmalinowski/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,davkean/roslyn,zooba/roslyn,swaroop-sridhar/roslyn,jaredpar/roslyn,jeffanders/roslyn,swaroop-sridhar/roslyn,stephentoub/roslyn,Pvlerick/roslyn,bartdesmet/roslyn,lorcanmooney/roslyn,MatthieuMEZIL/roslyn,tmat/roslyn,AlekseyTs/roslyn,wvdd007/roslyn,jhendrixMSFT/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,xasx/roslyn,ljw1004/roslyn,reaction1989/roslyn,ValentinRueda/roslyn,Shiney/roslyn,MattWindsor91/roslyn,MattWindsor91/roslyn,diryboy/roslyn,Pvlerick/roslyn,dotnet/roslyn,robinsedlaczek/roslyn,vcsjones/roslyn,SeriaWei/roslyn,MichalStrehovsky/roslyn,khyperia/roslyn,pdelvo/roslyn,KevinH-MS/roslyn,jcouv/roslyn,SeriaWei/roslyn,jkotas/roslyn,genlu/roslyn,ericfe-ms/roslyn,yeaicc/roslyn,akrisiun/roslyn,MichalStrehovsky/roslyn,AlekseyTs/roslyn,ValentinRueda/roslyn,jmarolf/roslyn,brettfo/roslyn,gafter/roslyn,stephentoub/roslyn,physhi/roslyn,physhi/roslyn,MattWindsor91/roslyn,kelltrick/roslyn,VSadov/roslyn,sharwell/roslyn,eriawan/roslyn,jaredpar/roslyn,KevinH-MS/roslyn,KirillOsenkov/roslyn,orthoxerox/roslyn,jcouv/roslyn,DustinCampbell/roslyn,DustinCampbell/roslyn,khyperia/roslyn,tmeschter/roslyn,dotnet/roslyn,CaptainHayashi/roslyn,diryboy/roslyn,AnthonyDGreen/roslyn,heejaechang/roslyn,pdelvo/roslyn,khellang/roslyn,vcsjones/roslyn,akrisiun/roslyn,leppie/roslyn,orthoxerox/roslyn,jkotas/roslyn,bbarry/roslyn,mmitche/roslyn,ErikSchierboom/roslyn,khyperia/roslyn,yeaicc/roslyn,OmarTawfik/roslyn,leppie/roslyn,leppie/roslyn,bkoelman/roslyn,SeriaWei/roslyn,srivatsn/roslyn,tmeschter/roslyn,bbarry/roslyn,tvand7093/roslyn,bartdesmet/roslyn,natidea/roslyn,vslsnap/roslyn,budcribar/roslyn,MatthieuMEZIL/roslyn,sharwell/roslyn,mavasani/roslyn,stephentoub/roslyn,wvdd007/roslyn,jeffanders/roslyn,xoofx/roslyn,gafter/roslyn,xasx/roslyn,diryboy/roslyn,Giftednewt/roslyn,jasonmalinowski/roslyn,ericfe-ms/roslyn,AnthonyDGreen/roslyn,ljw1004/roslyn,brettfo/roslyn,basoundr/roslyn,khellang/roslyn,dpoeschl/roslyn,bkoelman/roslyn,bkoelman/roslyn,xasx/roslyn,MichalStrehovsky/roslyn,abock/roslyn,mattscheffer/roslyn,xoofx/roslyn,ErikSchierboom/roslyn,mgoertz-msft/roslyn,OmarTawfik/roslyn,jamesqo/roslyn,cston/roslyn,mmitche/roslyn,tmat/roslyn,zooba/roslyn,panopticoncentral/roslyn,abock/roslyn,a-ctor/roslyn,eriawan/roslyn,jcouv/roslyn,mattwar/roslyn,CaptainHayashi/roslyn,Hosch250/roslyn,agocke/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,KevinRansom/roslyn,Hosch250/roslyn,jaredpar/roslyn,vslsnap/roslyn,jmarolf/roslyn,agocke/roslyn,tmeschter/roslyn,jamesqo/roslyn,genlu/roslyn,lorcanmooney/roslyn,tvand7093/roslyn,mattwar/roslyn,kelltrick/roslyn,AmadeusW/roslyn,balajikris/roslyn,natidea/roslyn,jeffanders/roslyn,natgla/roslyn,nguerrera/roslyn,KiloBravoLima/roslyn,KevinRansom/roslyn,mavasani/roslyn,mattscheffer/roslyn,balajikris/roslyn,KevinH-MS/roslyn,physhi/roslyn,weltkante/roslyn,tannergooding/roslyn,sharwell/roslyn,cston/roslyn,ValentinRueda/roslyn,xoofx/roslyn,panopticoncentral/roslyn,gafter/roslyn,MattWindsor91/roslyn,cston/roslyn,vslsnap/roslyn,CyrusNajmabadi/roslyn,jasonmalinowski/roslyn,AArnott/roslyn,kelltrick/roslyn,tannergooding/roslyn,VSadov/roslyn,budcribar/roslyn,AmadeusW/roslyn,mgoertz-msft/roslyn,dpoeschl/roslyn,paulvanbrenk/roslyn,amcasey/roslyn,AArnott/roslyn,sharadagrawal/Roslyn,tvand7093/roslyn,tmat/roslyn,KiloBravoLima/roslyn,michalhosala/roslyn,AlekseyTs/roslyn,khellang/roslyn,shyamnamboodiripad/roslyn,KiloBravoLima/roslyn,budcribar/roslyn,eriawan/roslyn,natgla/roslyn,KirillOsenkov/roslyn,CyrusNajmabadi/roslyn,paulvanbrenk/roslyn,ErikSchierboom/roslyn,MatthieuMEZIL/roslyn,brettfo/roslyn,basoundr/roslyn,aelij/roslyn,a-ctor/roslyn,TyOverby/roslyn,drognanar/roslyn,michalhosala/roslyn,natgla/roslyn,shyamnamboodiripad/roslyn,rgani/roslyn,dotnet/roslyn,amcasey/roslyn,balajikris/roslyn,reaction1989/roslyn,dpoeschl/roslyn,vcsjones/roslyn,robinsedlaczek/roslyn,TyOverby/roslyn,aelij/roslyn,yeaicc/roslyn,panopticoncentral/roslyn,weltkante/roslyn,amcasey/roslyn,mavasani/roslyn,swaroop-sridhar/roslyn,zooba/roslyn,ericfe-ms/roslyn,lorcanmooney/roslyn,drognanar/roslyn,jmarolf/roslyn,ljw1004/roslyn,rgani/roslyn,Pvlerick/roslyn,davkean/roslyn,drognanar/roslyn,CyrusNajmabadi/roslyn,a-ctor/roslyn,tannergooding/roslyn,DustinCampbell/roslyn,weltkante/roslyn,srivatsn/roslyn,robinsedlaczek/roslyn,agocke/roslyn,AmadeusW/roslyn,nguerrera/roslyn,shyamnamboodiripad/roslyn,KevinRansom/roslyn,Giftednewt/roslyn,sharadagrawal/Roslyn,aelij/roslyn,bbarry/roslyn,basoundr/roslyn,OmarTawfik/roslyn,Giftednewt/roslyn,Shiney/roslyn,akrisiun/roslyn,natidea/roslyn,Shiney/roslyn,KirillOsenkov/roslyn,CaptainHayashi/roslyn,reaction1989/roslyn,jkotas/roslyn,abock/roslyn,mattwar/roslyn,jamesqo/roslyn,sharadagrawal/Roslyn,VSadov/roslyn,jhendrixMSFT/roslyn,mmitche/roslyn,mgoertz-msft/roslyn,paulvanbrenk/roslyn,davkean/roslyn,TyOverby/roslyn,rgani/roslyn,jhendrixMSFT/roslyn,Hosch250/roslyn,genlu/roslyn,orthoxerox/roslyn,pdelvo/roslyn,mattscheffer/roslyn,srivatsn/roslyn,nguerrera/roslyn,heejaechang/roslyn
src/Test/Perf/util/runner_util.csx
src/Test/Perf/util/runner_util.csx
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. #r "..\infra\bin\Microsoft.CodeAnalysis.Scripting.dll" #r "..\infra\bin\Microsoft.CodeAnalysis.CSharp.Scripting.dll" using Microsoft.CodeAnalysis.Scripting; using Microsoft.CodeAnalysis.CSharp.Scripting; using System.Threading.Tasks; using System.Collections.Generic; using System.IO; using System.Linq; /// Finds all csi files in a directory recursively, ignoring those that /// are in the "skip" set. IEnumerable<string> AllCsiRecursive(string start, HashSet<string> skip) { IEnumerable<string> childFiles = from fileName in Directory.EnumerateFiles(start.ToString(), "*.csx") select fileName; IEnumerable<string> grandChildren = from childDir in Directory.EnumerateDirectories(start) where !skip.Contains(childDir) from fileName in AllCsiRecursive(childDir, skip) select fileName; return childFiles.Concat(grandChildren).Where((s) => !skip.Contains(s)); } /// Runs the script at fileName and returns a task containing the /// state of the script. async Task<ScriptState<object>> RunFile(string fileName) { var scriptOptions = ScriptOptions.Default.WithFilePath(fileName); var text = File.ReadAllText(fileName); var prelude = "System.Collections.Generic.List<string> Args = null;"; var state = await CSharpScript.RunAsync(prelude); var args = state.GetVariable("Args"); args.Value = Args; return await state.ContinueWithAsync<object>(text, scriptOptions); }
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. #r "bin\Microsoft.CodeAnalysis.Scripting.dll" #r "bin\Microsoft.CodeAnalysis.CSharp.Scripting.dll" using Microsoft.CodeAnalysis.Scripting; using Microsoft.CodeAnalysis.CSharp.Scripting; using System.Threading.Tasks; using System.Collections.Generic; using System.IO; using System.Linq; /// Finds all csi files in a directory recursively, ignoring those that /// are in the "skip" set. IEnumerable<string> AllCsiRecursive(string start, HashSet<string> skip) { IEnumerable<string> childFiles = from fileName in Directory.EnumerateFiles(start.ToString(), "*.csx") select fileName; IEnumerable<string> grandChildren = from childDir in Directory.EnumerateDirectories(start) where !skip.Contains(childDir) from fileName in AllCsiRecursive(childDir, skip) select fileName; return childFiles.Concat(grandChildren).Where((s) => !skip.Contains(s)); } /// Runs the script at fileName and returns a task containing the /// state of the script. async Task<ScriptState<object>> RunFile(string fileName) { var scriptOptions = ScriptOptions.Default.WithFilePath(fileName); var text = File.ReadAllText(fileName); var prelude = "System.Collections.Generic.List<string> Args = null;"; var state = await CSharpScript.RunAsync(prelude); var args = state.GetVariable("Args"); args.Value = Args; return await state.ContinueWithAsync<object>(text, scriptOptions); }
mit
C#
cc450ed8cebfe0cd0767d65b1867d0dec6b45845
Update the version for migration project
ravimeda/cli,weshaggard/cli,livarcocc/cli-1,dasMulli/cli,nguerrera/cli,Faizan2304/cli,jonsequitur/cli,livarcocc/cli-1,jonsequitur/cli,jonsequitur/cli,EdwardBlair/cli,nguerrera/cli,mlorbetske/cli,mlorbetske/cli,livarcocc/cli-1,nguerrera/cli,svick/cli,EdwardBlair/cli,blackdwarf/cli,blackdwarf/cli,svick/cli,Faizan2304/cli,AbhitejJohn/cli,weshaggard/cli,AbhitejJohn/cli,johnbeisner/cli,mlorbetske/cli,EdwardBlair/cli,harshjain2/cli,blackdwarf/cli,Faizan2304/cli,weshaggard/cli,harshjain2/cli,ravimeda/cli,weshaggard/cli,AbhitejJohn/cli,dasMulli/cli,svick/cli,jonsequitur/cli,nguerrera/cli,weshaggard/cli,AbhitejJohn/cli,johnbeisner/cli,dasMulli/cli,johnbeisner/cli,mlorbetske/cli,harshjain2/cli,ravimeda/cli,blackdwarf/cli
src/Microsoft.DotNet.ProjectJsonMigration/ConstantPackageVersions.cs
src/Microsoft.DotNet.ProjectJsonMigration/ConstantPackageVersions.cs
// Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.DotNet.ProjectJsonMigration { internal class ConstantPackageVersions { public const string AspNetToolsVersion = "1.0.0-msbuild1-final"; public const string TestSdkPackageVersion = "15.0.0-preview-20161024-02"; public const string XUnitPackageVersion = "2.2.0-beta4-build3444"; public const string XUnitRunnerPackageVersion = "2.2.0-beta4-build1194"; public const string MstestTestAdapterVersion = "1.1.3-preview"; public const string MstestTestFrameworkVersion = "1.0.4-preview"; public const string BundleMinifierToolVersion = "2.2.301"; } }
// Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.DotNet.ProjectJsonMigration { internal class ConstantPackageVersions { public const string AspNetToolsVersion = "1.0.0-msbuild1-final"; public const string TestSdkPackageVersion = "15.0.0-preview-20161024-02"; public const string XUnitPackageVersion = "2.2.0-beta3-build3402"; public const string XUnitRunnerPackageVersion = "2.2.0-beta4-build1188"; public const string MstestTestAdapterVersion = "1.1.3-preview"; public const string MstestTestFrameworkVersion = "1.0.4-preview"; public const string BundleMinifierToolVersion = "2.2.301"; } }
mit
C#
4f5c7c7db1a7d1b754351f81e1712c9ca9c6bea2
Rename 'Browse Gallery' to 'Browse Media'
yonglehou/Orchard,fortunearterial/Orchard,jchenga/Orchard,jerryshi2007/Orchard,omidnasri/Orchard,Codinlab/Orchard,asabbott/chicagodevnet-website,vard0/orchard.tan,xiaobudian/Orchard,Inner89/Orchard,spraiin/Orchard,gcsuk/Orchard,phillipsj/Orchard,qt1/Orchard,vairam-svs/Orchard,smartnet-developers/Orchard,Cphusion/Orchard,luchaoshuai/Orchard,bedegaming-aleksej/Orchard,IDeliverable/Orchard,planetClaire/Orchard-LETS,AndreVolksdorf/Orchard,NIKASoftwareDevs/Orchard,sfmskywalker/Orchard,qt1/Orchard,Praggie/Orchard,harmony7/Orchard,RoyalVeterinaryCollege/Orchard,openbizgit/Orchard,omidnasri/Orchard,bigfont/orchard-continuous-integration-demo,ehe888/Orchard,infofromca/Orchard,arminkarimi/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,armanforghani/Orchard,ehe888/Orchard,LaserSrl/Orchard,qt1/orchard4ibn,infofromca/Orchard,Dolphinsimon/Orchard,OrchardCMS/Orchard,SzymonSel/Orchard,MetSystem/Orchard,salarvand/orchard,andyshao/Orchard,jerryshi2007/Orchard,jchenga/Orchard,enspiral-dev-academy/Orchard,OrchardCMS/Orchard-Harvest-Website,mvarblow/Orchard,jersiovic/Orchard,hhland/Orchard,Morgma/valleyviewknolls,neTp9c/Orchard,emretiryaki/Orchard,dozoft/Orchard,salarvand/Portal,stormleoxia/Orchard,salarvand/orchard,salarvand/Portal,IDeliverable/Orchard,sebastienros/msc,li0803/Orchard,OrchardCMS/Orchard-Harvest-Website,phillipsj/Orchard,gcsuk/Orchard,OrchardCMS/Orchard-Harvest-Website,qt1/orchard4ibn,caoxk/orchard,alejandroaldana/Orchard,oxwanawxo/Orchard,dcinzona/Orchard-Harvest-Website,tobydodds/folklife,Lombiq/Orchard,bigfont/orchard-cms-modules-and-themes,infofromca/Orchard,Morgma/valleyviewknolls,Dolphinsimon/Orchard,JRKelso/Orchard,li0803/Orchard,jerryshi2007/Orchard,emretiryaki/Orchard,geertdoornbos/Orchard,qt1/orchard4ibn,bigfont/orchard-cms-modules-and-themes,jchenga/Orchard,SeyDutch/Airbrush,AEdmunds/beautiful-springtime,escofieldnaxos/Orchard,OrchardCMS/Orchard,Praggie/Orchard,planetClaire/Orchard-LETS,gcsuk/Orchard,bigfont/orchard-continuous-integration-demo,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,dcinzona/Orchard-Harvest-Website,gcsuk/Orchard,jersiovic/Orchard,Cphusion/Orchard,openbizgit/Orchard,marcoaoteixeira/Orchard,arminkarimi/Orchard,openbizgit/Orchard,AndreVolksdorf/Orchard,Ermesx/Orchard,qt1/Orchard,phillipsj/Orchard,Inner89/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,oxwanawxo/Orchard,AndreVolksdorf/Orchard,huoxudong125/Orchard,AdvantageCS/Orchard,JRKelso/Orchard,brownjordaninternational/OrchardCMS,RoyalVeterinaryCollege/Orchard,enspiral-dev-academy/Orchard,vard0/orchard.tan,jersiovic/Orchard,hbulzy/Orchard,dcinzona/Orchard-Harvest-Website,DonnotRain/Orchard,jimasp/Orchard,brownjordaninternational/OrchardCMS,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,caoxk/orchard,jtkech/Orchard,dozoft/Orchard,AEdmunds/beautiful-springtime,Morgma/valleyviewknolls,johnnyqian/Orchard,bedegaming-aleksej/Orchard,geertdoornbos/Orchard,salarvand/orchard,TalaveraTechnologySolutions/Orchard,Serlead/Orchard,geertdoornbos/Orchard,dcinzona/Orchard-Harvest-Website,MpDzik/Orchard,ericschultz/outercurve-orchard,oxwanawxo/Orchard,OrchardCMS/Orchard-Harvest-Website,mgrowan/Orchard,kouweizhong/Orchard,rtpHarry/Orchard,dcinzona/Orchard-Harvest-Website,TalaveraTechnologySolutions/Orchard,bigfont/orchard-continuous-integration-demo,SeyDutch/Airbrush,smartnet-developers/Orchard,dburriss/Orchard,aaronamm/Orchard,Codinlab/Orchard,luchaoshuai/Orchard,Ermesx/Orchard,SzymonSel/Orchard,andyshao/Orchard,austinsc/Orchard,patricmutwiri/Orchard,xkproject/Orchard,sebastienros/msc,jimasp/Orchard,Lombiq/Orchard,oxwanawxo/Orchard,DonnotRain/Orchard,KeithRaven/Orchard,IDeliverable/Orchard,escofieldnaxos/Orchard,NIKASoftwareDevs/Orchard,AndreVolksdorf/Orchard,jtkech/Orchard,vairam-svs/Orchard,Morgma/valleyviewknolls,Sylapse/Orchard.HttpAuthSample,cryogen/orchard,spraiin/Orchard,vard0/orchard.tan,stormleoxia/Orchard,stormleoxia/Orchard,DonnotRain/Orchard,armanforghani/Orchard,Fogolan/OrchardForWork,smartnet-developers/Orchard,hannan-azam/Orchard,Serlead/Orchard,huoxudong125/Orchard,ericschultz/outercurve-orchard,armanforghani/Orchard,yersans/Orchard,planetClaire/Orchard-LETS,xkproject/Orchard,johnnyqian/Orchard,cryogen/orchard,kouweizhong/Orchard,stormleoxia/Orchard,neTp9c/Orchard,angelapper/Orchard,NIKASoftwareDevs/Orchard,rtpHarry/Orchard,emretiryaki/Orchard,sebastienros/msc,hannan-azam/Orchard,vard0/orchard.tan,TaiAivaras/Orchard,SzymonSel/Orchard,neTp9c/Orchard,RoyalVeterinaryCollege/Orchard,tobydodds/folklife,jersiovic/Orchard,qt1/Orchard,yonglehou/Orchard,sfmskywalker/Orchard,Cphusion/Orchard,Praggie/Orchard,kouweizhong/Orchard,Lombiq/Orchard,TaiAivaras/Orchard,yonglehou/Orchard,brownjordaninternational/OrchardCMS,arminkarimi/Orchard,bedegaming-aleksej/Orchard,tobydodds/folklife,cooclsee/Orchard,MetSystem/Orchard,salarvand/orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,sebastienros/msc,qt1/Orchard,yonglehou/Orchard,vairam-svs/Orchard,grapto/Orchard.CloudBust,mvarblow/Orchard,Anton-Am/Orchard,hannan-azam/Orchard,ehe888/Orchard,TalaveraTechnologySolutions/Orchard,Lombiq/Orchard,AndreVolksdorf/Orchard,IDeliverable/Orchard,alejandroaldana/Orchard,hbulzy/Orchard,yersans/Orchard,fassetar/Orchard,patricmutwiri/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,rtpHarry/Orchard,SouleDesigns/SouleDesigns.Orchard,yersans/Orchard,angelapper/Orchard,xkproject/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,omidnasri/Orchard,TalaveraTechnologySolutions/Orchard,Cphusion/Orchard,xiaobudian/Orchard,asabbott/chicagodevnet-website,Sylapse/Orchard.HttpAuthSample,dburriss/Orchard,TaiAivaras/Orchard,grapto/Orchard.CloudBust,fassetar/Orchard,hbulzy/Orchard,patricmutwiri/Orchard,SouleDesigns/SouleDesigns.Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,vard0/orchard.tan,SeyDutch/Airbrush,dcinzona/Orchard-Harvest-Website,patricmutwiri/Orchard,MpDzik/Orchard,enspiral-dev-academy/Orchard,hhland/Orchard,MpDzik/Orchard,jaraco/orchard,Codinlab/Orchard,Sylapse/Orchard.HttpAuthSample,JRKelso/Orchard,abhishekluv/Orchard,OrchardCMS/Orchard-Harvest-Website,caoxk/orchard,jchenga/Orchard,marcoaoteixeira/Orchard,geertdoornbos/Orchard,harmony7/Orchard,NIKASoftwareDevs/Orchard,MetSystem/Orchard,salarvand/orchard,aaronamm/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,alejandroaldana/Orchard,bedegaming-aleksej/Orchard,jaraco/orchard,jtkech/Orchard,jagraz/Orchard,Lombiq/Orchard,dozoft/Orchard,jerryshi2007/Orchard,Codinlab/Orchard,Dolphinsimon/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,ericschultz/outercurve-orchard,enspiral-dev-academy/Orchard,asabbott/chicagodevnet-website,gcsuk/Orchard,dcinzona/Orchard,hbulzy/Orchard,infofromca/Orchard,spraiin/Orchard,huoxudong125/Orchard,cryogen/orchard,Ermesx/Orchard,Codinlab/Orchard,dburriss/Orchard,qt1/orchard4ibn,spraiin/Orchard,KeithRaven/Orchard,Serlead/Orchard,yersans/Orchard,sfmskywalker/Orchard,mvarblow/Orchard,hannan-azam/Orchard,MpDzik/Orchard,Serlead/Orchard,Dolphinsimon/Orchard,neTp9c/Orchard,vairam-svs/Orchard,hhland/Orchard,salarvand/Portal,xiaobudian/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,vard0/orchard.tan,KeithRaven/Orchard,jtkech/Orchard,xiaobudian/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,jagraz/Orchard,AdvantageCS/Orchard,arminkarimi/Orchard,mgrowan/Orchard,phillipsj/Orchard,abhishekluv/Orchard,LaserSrl/Orchard,SzymonSel/Orchard,aaronamm/Orchard,Sylapse/Orchard.HttpAuthSample,DonnotRain/Orchard,qt1/orchard4ibn,fortunearterial/Orchard,Fogolan/OrchardForWork,harmony7/Orchard,grapto/Orchard.CloudBust,cooclsee/Orchard,LaserSrl/Orchard,dozoft/Orchard,fassetar/Orchard,sebastienros/msc,austinsc/Orchard,xkproject/Orchard,rtpHarry/Orchard,sfmskywalker/Orchard,DonnotRain/Orchard,Cphusion/Orchard,Anton-Am/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,brownjordaninternational/OrchardCMS,Sylapse/Orchard.HttpAuthSample,Fogolan/OrchardForWork,AdvantageCS/Orchard,jtkech/Orchard,TaiAivaras/Orchard,kgacova/Orchard,Ermesx/Orchard,Fogolan/OrchardForWork,abhishekluv/Orchard,angelapper/Orchard,jagraz/Orchard,SouleDesigns/SouleDesigns.Orchard,caoxk/orchard,sfmskywalker/Orchard,xkproject/Orchard,kgacova/Orchard,dcinzona/Orchard,harmony7/Orchard,TaiAivaras/Orchard,Morgma/valleyviewknolls,luchaoshuai/Orchard,bigfont/orchard-cms-modules-and-themes,Anton-Am/Orchard,KeithRaven/Orchard,li0803/Orchard,openbizgit/Orchard,NIKASoftwareDevs/Orchard,SeyDutch/Airbrush,KeithRaven/Orchard,huoxudong125/Orchard,salarvand/Portal,aaronamm/Orchard,TalaveraTechnologySolutions/Orchard,hbulzy/Orchard,luchaoshuai/Orchard,escofieldnaxos/Orchard,fassetar/Orchard,Inner89/Orchard,alejandroaldana/Orchard,TalaveraTechnologySolutions/Orchard,kgacova/Orchard,johnnyqian/Orchard,abhishekluv/Orchard,m2cms/Orchard,austinsc/Orchard,LaserSrl/Orchard,LaserSrl/Orchard,kouweizhong/Orchard,fortunearterial/Orchard,abhishekluv/Orchard,yonglehou/Orchard,OrchardCMS/Orchard,aaronamm/Orchard,sfmskywalker/Orchard,omidnasri/Orchard,dcinzona/Orchard,bedegaming-aleksej/Orchard,dcinzona/Orchard,omidnasri/Orchard,abhishekluv/Orchard,sfmskywalker/Orchard,enspiral-dev-academy/Orchard,asabbott/chicagodevnet-website,hhland/Orchard,kgacova/Orchard,li0803/Orchard,planetClaire/Orchard-LETS,bigfont/orchard-cms-modules-and-themes,jimasp/Orchard,RoyalVeterinaryCollege/Orchard,m2cms/Orchard,planetClaire/Orchard-LETS,johnnyqian/Orchard,SeyDutch/Airbrush,Anton-Am/Orchard,sfmskywalker/Orchard,Praggie/Orchard,openbizgit/Orchard,Anton-Am/Orchard,ehe888/Orchard,kouweizhong/Orchard,jaraco/orchard,rtpHarry/Orchard,escofieldnaxos/Orchard,TalaveraTechnologySolutions/Orchard,li0803/Orchard,jimasp/Orchard,Inner89/Orchard,OrchardCMS/Orchard-Harvest-Website,grapto/Orchard.CloudBust,Serlead/Orchard,OrchardCMS/Orchard,cooclsee/Orchard,SzymonSel/Orchard,jimasp/Orchard,JRKelso/Orchard,dcinzona/Orchard,cryogen/orchard,MetSystem/Orchard,emretiryaki/Orchard,neTp9c/Orchard,dburriss/Orchard,arminkarimi/Orchard,austinsc/Orchard,vairam-svs/Orchard,cooclsee/Orchard,fortunearterial/Orchard,mvarblow/Orchard,Inner89/Orchard,armanforghani/Orchard,johnnyqian/Orchard,harmony7/Orchard,jaraco/orchard,hhland/Orchard,AEdmunds/beautiful-springtime,armanforghani/Orchard,Dolphinsimon/Orchard,fassetar/Orchard,m2cms/Orchard,yersans/Orchard,huoxudong125/Orchard,IDeliverable/Orchard,jchenga/Orchard,geertdoornbos/Orchard,salarvand/Portal,tobydodds/folklife,luchaoshuai/Orchard,MpDzik/Orchard,smartnet-developers/Orchard,alejandroaldana/Orchard,infofromca/Orchard,SouleDesigns/SouleDesigns.Orchard,grapto/Orchard.CloudBust,phillipsj/Orchard,OrchardCMS/Orchard,xiaobudian/Orchard,austinsc/Orchard,dozoft/Orchard,mgrowan/Orchard,hannan-azam/Orchard,oxwanawxo/Orchard,cooclsee/Orchard,jersiovic/Orchard,AEdmunds/beautiful-springtime,andyshao/Orchard,spraiin/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,omidnasri/Orchard,bigfont/orchard-continuous-integration-demo,smartnet-developers/Orchard,jerryshi2007/Orchard,TalaveraTechnologySolutions/Orchard,ericschultz/outercurve-orchard,marcoaoteixeira/Orchard,AdvantageCS/Orchard,Praggie/Orchard,MpDzik/Orchard,brownjordaninternational/OrchardCMS,omidnasri/Orchard,omidnasri/Orchard,jagraz/Orchard,kgacova/Orchard,omidnasri/Orchard,JRKelso/Orchard,Ermesx/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,ehe888/Orchard,marcoaoteixeira/Orchard,AdvantageCS/Orchard,m2cms/Orchard,andyshao/Orchard,grapto/Orchard.CloudBust,MetSystem/Orchard,escofieldnaxos/Orchard,tobydodds/folklife,SouleDesigns/SouleDesigns.Orchard,angelapper/Orchard,bigfont/orchard-cms-modules-and-themes,mgrowan/Orchard,mvarblow/Orchard,andyshao/Orchard,emretiryaki/Orchard,qt1/orchard4ibn,Fogolan/OrchardForWork,RoyalVeterinaryCollege/Orchard,mgrowan/Orchard,fortunearterial/Orchard,jagraz/Orchard,stormleoxia/Orchard,dburriss/Orchard,tobydodds/folklife,angelapper/Orchard,patricmutwiri/Orchard,marcoaoteixeira/Orchard,m2cms/Orchard
src/Orchard.Web/Modules/Orchard.MediaPicker/Views/Admin/Index.cshtml
src/Orchard.Web/Modules/Orchard.MediaPicker/Views/Admin/Index.cshtml
@model Orchard.Media.ViewModels.MediaFolderEditViewModel @using Orchard.Media.Extensions; @using Orchard.Media.Helpers; @using Orchard.Media.Services; @using Orchard.Media.Models; @using Orchard.UI.Resources; @{ // these need to be in the head because MediaBrowser.js defines a callback that the thumbnail images call when they load, // which could happen as soon as they render. Style.Require("jQueryUI_Orchard").AtHead(); Script.Require("jQueryUI_Tabs").AtHead(); Script.Include("MediaBrowser.js").AtHead(); Style.Include("~/themes/theadmin/styles/site.css"); Style.Include("~/themes/theadmin/styles/ie.css").UseCondition("lte IE 8").SetAttribute("media", "screen, projection"); Style.Include("~/themes/theadmin/styles/ie6.css").UseCondition("lte IE 6").SetAttribute("media", "screen, projection"); Style.Include("mediapicker.css"); } <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>@T("Pick Image")</title> @Display.Metas() @Display.HeadScripts() @Display.HeadLinks() @Display.StyleSheetLinks() </head> <body id="orchardmediapicker"> <div id="tabs" class="group"> <ul> <li><a href="#tab-url" data-edittext="@T("Update/Upload Image")" data-edittext-content="true">@T("Insert/Upload Image")</a></li> <li><a href="#tab-gallery">@T("Browse Media")</a></li> </ul> <div id="tab-url"> @Html.Partial("Tab_Url", Model) </div> <div id="tab-gallery"> @Html.Partial("Tab_Gallery", Model) </div> </div> @Display.FootScripts() </body> </html>
@model Orchard.Media.ViewModels.MediaFolderEditViewModel @using Orchard.Media.Extensions; @using Orchard.Media.Helpers; @using Orchard.Media.Services; @using Orchard.Media.Models; @using Orchard.UI.Resources; @{ // these need to be in the head because MediaBrowser.js defines a callback that the thumbnail images call when they load, // which could happen as soon as they render. Style.Require("jQueryUI_Orchard").AtHead(); Script.Require("jQueryUI_Tabs").AtHead(); Script.Include("MediaBrowser.js").AtHead(); Style.Include("~/themes/theadmin/styles/site.css"); Style.Include("~/themes/theadmin/styles/ie.css").UseCondition("lte IE 8").SetAttribute("media", "screen, projection"); Style.Include("~/themes/theadmin/styles/ie6.css").UseCondition("lte IE 6").SetAttribute("media", "screen, projection"); Style.Include("mediapicker.css"); } <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>@T("Pick Image")</title> @Display.Metas() @Display.HeadScripts() @Display.HeadLinks() @Display.StyleSheetLinks() </head> <body id="orchardmediapicker"> <div id="tabs" class="group"> <ul> <li><a href="#tab-url" data-edittext="@T("Update/Upload Image")" data-edittext-content="true">@T("Insert/Upload Image")</a></li> <li><a href="#tab-gallery">@T("Browse Gallery")</a></li> </ul> <div id="tab-url"> @Html.Partial("Tab_Url", Model) </div> <div id="tab-gallery"> @Html.Partial("Tab_Gallery", Model) </div> </div> @Display.FootScripts() </body> </html>
bsd-3-clause
C#
b8c1a63015a39c544815fc406e930be03c804104
Use GLib.Marshaller to handle our string freeing and marshalling
hyperair/libgpod,neuschaefer/libgpod,neuschaefer/libgpod,hyperair/libgpod,neuschaefer/libgpod,hyperair/libgpod,neuschaefer/libgpod,hyperair/libgpod,neuschaefer/libgpod,hyperair/libgpod
bindings/mono/libgpod-sharp/GPodBase.cs
bindings/mono/libgpod-sharp/GPodBase.cs
/* * Copyright (c) 2010 Nathaniel McCallum <nathaniel@natemccallum.com> * * The code contained in this file is free software; you can redistribute * it and/or modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either version * 2.1 of the License, or (at your option) any later version. * * This file is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this code; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ namespace GPod { using System; using System.Collections.Generic; using System.Runtime.InteropServices; interface IGPodBase { IntPtr Native { get; } void SetBorrowed(bool borrowed); } public abstract class GPodBase<T> : IGPodBase, IDisposable { protected static string PtrToStringUTF8 (IntPtr ptr) { return GLib.Marshaller.Utf8PtrToString (ptr); } protected static void ReplaceStringUTF8 (ref IntPtr ptr, string str) { GLib.Marshaller.Free (ptr); ptr = GLib.Marshaller.StringToPtrGStrdup (str); } protected static IntPtr DateTimeTotime_t (DateTime time) { return GLib.Marshaller.DateTimeTotime_t (time); } protected static DateTime time_tToDateTime (IntPtr time_t) { return GLib.Marshaller.time_tToDateTime (time_t); } internal IntPtr Native { get { return HandleRef.ToIntPtr (Handle); } } IntPtr IGPodBase.Native { get { return Native; } } public HandleRef Handle; protected bool Borrowed; public GPodBase(IntPtr handle) : this(handle, true) {} public GPodBase(IntPtr handle, bool borrowed) { Borrowed = borrowed; Handle = new HandleRef (this, handle); } ~GPodBase() { if (!Borrowed) Destroy(); } public void SetBorrowed(bool borrowed) { Borrowed = borrowed; } protected abstract void Destroy(); public void Dispose () { if (!Borrowed) Destroy (); } } }
/* * Copyright (c) 2010 Nathaniel McCallum <nathaniel@natemccallum.com> * * The code contained in this file is free software; you can redistribute * it and/or modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either version * 2.1 of the License, or (at your option) any later version. * * This file is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this code; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ namespace GPod { using System; using System.Collections.Generic; using System.Runtime.InteropServices; interface IGPodBase { IntPtr Native { get; } void SetBorrowed(bool borrowed); } public abstract class GPodBase<T> : IGPodBase, IDisposable { protected static IntPtr StringToPtrUTF8 (string s) { if (s == null) return IntPtr.Zero; // We should P/Invoke g_strdup with 's' and return that pointer. return Marshal.StringToHGlobalAuto (s); } protected static string PtrToStringUTF8 (IntPtr ptr) { // FIXME: Enforce this to be UTF8, this actually uses platform encoding // which is probably going to be utf8 on most linuxes. return Marshal.PtrToStringAuto (ptr); } protected static void ReplaceStringUTF8 (ref IntPtr ptr, string str) { if (ptr != IntPtr.Zero) { // FIXME: g_free it } ptr = StringToPtrUTF8 (str); } protected static IntPtr DateTimeTotime_t (DateTime time) { DateTime epoch = new DateTime (1970, 1, 1, 0, 0, 0); return new IntPtr (((int) time.ToUniversalTime().Subtract(epoch).TotalSeconds)); } protected static DateTime time_tToDateTime (IntPtr time_t) { DateTime epoch = new DateTime (1970, 1, 1, 0, 0, 0); int utc_offset = (int)(TimeZone.CurrentTimeZone.GetUtcOffset (DateTime.Now)).TotalSeconds; return epoch.AddSeconds((int)time_t + utc_offset); } internal IntPtr Native { get { return HandleRef.ToIntPtr (Handle); } } IntPtr IGPodBase.Native { get { return Native; } } public HandleRef Handle; protected bool Borrowed; public GPodBase(IntPtr handle) : this(handle, true) {} public GPodBase(IntPtr handle, bool borrowed) { Borrowed = borrowed; Handle = new HandleRef (this, handle); } ~GPodBase() { if (!Borrowed) Destroy(); } public void SetBorrowed(bool borrowed) { Borrowed = borrowed; } protected abstract void Destroy(); public void Dispose () { if (!Borrowed) Destroy (); } } }
lgpl-2.1
C#
82c1be3304c49bc71b6ee5382fbe4c80ee41a4bb
change implementation of ControlBlock
myxini/block-program
block-program/Detection/ControlBlock.cs
block-program/Detection/ControlBlock.cs
namespace Myxini.Recognition { public class ControlBlock : IBlock { public ControlBlock(Command command, BlockParameter parameter) { } public bool IsControlBlock { get { return true; } } public Command CommandIdentification { get; private set; } public BlockParameter Parameter { get; private set; } } }
namespace Myxini.Recognition { public class ControlBlock : Instruction { public ControlBlock(Command command, BlockParameter parameter) : base(command, parameter, true) { } } }
mit
C#
55d42787f52f266856807de77d4f9bc8c9ffdcf1
Fix formatting - CI build merge fail
dotnet/roslyn-analyzers,mavasani/roslyn-analyzers,dotnet/roslyn-analyzers,pakdev/roslyn-analyzers,mavasani/roslyn-analyzers,pakdev/roslyn-analyzers
src/NetAnalyzers/UnitTests/Microsoft.NetFramework.Analyzers/DoNotUseInsecureDtdProcessingXmlDocumentSecureDefaultXmlResolverAnalyzerTests.cs
src/NetAnalyzers/UnitTests/Microsoft.NetFramework.Analyzers/DoNotUseInsecureDtdProcessingXmlDocumentSecureDefaultXmlResolverAnalyzerTests.cs
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Threading.Tasks; using Microsoft.CodeAnalysis.Testing; using Xunit; using VerifyCS = Test.Utilities.CSharpSecurityCodeFixVerifier< Microsoft.NetFramework.Analyzers.DoNotUseInsecureDtdProcessingAnalyzer, Microsoft.CodeAnalysis.Testing.EmptyCodeFixProvider>; namespace Microsoft.NetFramework.Analyzers.UnitTests { public partial class DoNotUseInsecureDtdProcessingAnalyzerTests { private static DiagnosticResult GetCSharpResultAt(int line, int column) => VerifyCS.Diagnostic(DoNotUseInsecureDtdProcessingAnalyzer.RuleXmlDocumentWithNoSecureResolver).WithLocation(line, column); [Fact] public async Task XmlDocumentDefaultResolversInXmlReaderSettingsPre452ShouldGenerateDiagnostic() { await VerifyCSharpAnalyzerAsync( ReferenceAssemblies.NetFramework.Net451.Default, @" using System; using System.Reflection; using System.Xml; namespace TestNamespace { public class TestClass { public void TestMethod(string path) { XmlReaderSettings settings = new XmlReaderSettings(); XmlReader reader = XmlReader.Create(path, settings); XmlDocument doc = new XmlDocument(); doc.Load(reader); } } } ", GetCSharpResultAt(14, 31) ); } [Fact] public async Task XmlDocumentDefaultResolversInXmlReaderSettingsPre452ShouldNotGenerateDiagnostic() { await VerifyCSharpAnalyzerAsync( ReferenceAssemblies.NetFramework.Net452.Default, @" using System; using System.Reflection; using System.Xml; namespace TestNamespace { public class TestClass { public void TestMethod(string path) { XmlReaderSettings settings = new XmlReaderSettings(); XmlReader reader = XmlReader.Create(path, settings); XmlDocument doc = new XmlDocument(); doc.Load(reader); } } } " ); } } }
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Threading.Tasks; using Microsoft.CodeAnalysis.Testing; using Xunit; using VerifyCS = Test.Utilities.CSharpSecurityCodeFixVerifier< Microsoft.NetFramework.Analyzers.DoNotUseInsecureDtdProcessingAnalyzer, Microsoft.CodeAnalysis.Testing.EmptyCodeFixProvider>; namespace Microsoft.NetFramework.Analyzers.UnitTests { public partial class DoNotUseInsecureDtdProcessingAnalyzerTests { private static DiagnosticResult GetCSharpResultAt(int line, int column) => VerifyCS.Diagnostic(DoNotUseInsecureDtdProcessingAnalyzer.RuleXmlDocumentWithNoSecureResolver).WithLocation(line, column); [Fact] public async Task XmlDocumentDefaultResolversInXmlReaderSettingsPre452ShouldGenerateDiagnostic() { await VerifyCSharpAnalyzerAsync( ReferenceAssemblies.NetFramework.Net451.Default, @" using System; using System.Reflection; using System.Xml; namespace TestNamespace { public class TestClass { public void TestMethod(string path) { XmlReaderSettings settings = new XmlReaderSettings(); XmlReader reader = XmlReader.Create(path, settings); XmlDocument doc = new XmlDocument(); doc.Load(reader); } } } ", GetCSharpResultAt(14, 31) ); } [Fact] public async Task XmlDocumentDefaultResolversInXmlReaderSettingsPre452ShouldNotGenerateDiagnostic() { await VerifyCSharpAnalyzerAsync( ReferenceAssemblies.NetFramework.Net452.Default, @" using System; using System.Reflection; using System.Xml; namespace TestNamespace { public class TestClass { public void TestMethod(string path) { XmlReaderSettings settings = new XmlReaderSettings(); XmlReader reader = XmlReader.Create(path, settings); XmlDocument doc = new XmlDocument(); doc.Load(reader); } } } " ); } } }
mit
C#
5f0a8e139ea213fa84c654d112fd67d1ec0c9f2b
Update ConsoleAppPublisher to common construct
MassTransit/MassTransit,MassTransit/MassTransit,phatboyg/MassTransit,phatboyg/MassTransit
docs/code/configuration/ConsoleAppPublisher.cs
docs/code/configuration/ConsoleAppPublisher.cs
namespace EventContracts { public interface ValueEntered { string Value { get; } } } namespace ConsoleEventPublisher { using System; using System.Threading; using System.Threading.Tasks; using EventContracts; using MassTransit; public class Program { public static async Task Main() { var busControl = Bus.Factory.CreateUsingRabbitMq(); var source = new CancellationTokenSource(TimeSpan.FromSeconds(10)); await busControl.StartAsync(source.Token); try { while (true) { string value = await Task.Run(() => { Console.WriteLine("Enter message (or quit to exit)"); Console.Write("> "); return Console.ReadLine(); }); if("quit".Equals(value, StringComparison.OrdinalIgnoreCase)) break; await busControl.Publish<ValueEntered>(new { Value = value }); } } finally { await busControl.StopAsync(); } } } }
namespace EventContracts { public interface ValueEntered { string Value { get; } } } namespace ConsoleEventPublisher { using System; using System.Threading; using System.Threading.Tasks; using EventContracts; using MassTransit; public class Program { public static async Task Main() { var busControl = Bus.Factory.CreateUsingRabbitMq(); var source = new CancellationTokenSource(TimeSpan.FromSeconds(10)); await busControl.StartAsync(source.Token); try { do { string value = await Task.Run(() => { Console.WriteLine("Enter message (or quit to exit)"); Console.Write("> "); return Console.ReadLine(); }); if("quit".Equals(value, StringComparison.OrdinalIgnoreCase)) break; await busControl.Publish<ValueEntered>(new { Value = value }); } while (true); } finally { await busControl.StopAsync(); } } } }
apache-2.0
C#
83c6735c56da1a075f2d5ce8e7f94dd5207294ba
Format source
danielmundt/csremote
source/Remoting.Client/FormMain.cs
source/Remoting.Client/FormMain.cs
#region Header // Copyright (C) 2012 Daniel Schubert // // Permission is hereby granted, free of charge, to any person obtaining a copy of this software // and associated documentation files (the "Software"), to deal in the Software without restriction, // including without limitation the rights to use, copy, modify, merge, publish, distribute, // sublicense, and/or sell copies of the Software, and to permit persons to whom the Software // is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all copies or // substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE // AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #endregion Header using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Runtime.Remoting; using System.Text; using System.Threading; using System.Windows.Forms; using Remoting.Core; using Remoting.Core.Channels; using Remoting.Core.Events; namespace Remoting.Client { public partial class FormMain : Form { #region Fields private IRemoteService service; #endregion Fields #region Constructors public FormMain() { InitializeComponent(); InitializeClient(); } #endregion Constructors #region Delegates delegate void SetTextCallback(string text); #endregion Delegates #region Methods private void btnSend_Click(object sender, EventArgs e) { DispatchCall(); } private void DispatchCall() { try { EventProxy proxy = new EventProxy(tbClientId.Text); proxy.EventDispatched += new EventHandler<EventDispatchedEventArgs>(proxy_EventDispatched); service.DispatchCall(proxy, "Hello World"); } catch (RemotingException ex) { MessageBox.Show(this, ex.Message, "Error"); } } private void FormMain_Load(object sender, EventArgs e) { tbClientId.Text = Guid.NewGuid().ToString("N"); } private void InitializeClient() { ClientChannel channel = (ClientChannel)ChannelFactory.GetChannel( ChannelFactory.Type.Client); if (channel != null) { service = channel.Initialize(); } } private void proxy_EventDispatched(object sender, EventDispatchedEventArgs e) { SetText(string.Format("EventDispatched: {0}{1}", (string)e.Data, Environment.NewLine)); } private void SetText(string text) { // thread-safe call if (tbLog.InvokeRequired) { SetTextCallback d = new SetTextCallback(SetText); this.Invoke(d, new object[] { text }); } else { tbLog.AppendText(text); } } #endregion Methods } }
#region Header // Copyright (C) 2012 Daniel Schubert // // Permission is hereby granted, free of charge, to any person obtaining a copy of this software // and associated documentation files (the "Software"), to deal in the Software without restriction, // including without limitation the rights to use, copy, modify, merge, publish, distribute, // sublicense, and/or sell copies of the Software, and to permit persons to whom the Software // is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all copies or // substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE // AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #endregion Header using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Runtime.Remoting; using System.Text; using System.Threading; using System.Windows.Forms; using Remoting.Core; using Remoting.Core.Channels; using Remoting.Core.Events; namespace Remoting.Client { public partial class FormMain : Form { #region Fields private IRemoteService service; #endregion Fields #region Constructors public FormMain() { InitializeComponent(); InitializeClient(); } #endregion Constructors #region Delegates delegate void SetTextCallback(string text); #endregion Delegates #region Methods private void DispatchCall() { try { EventProxy proxy = new EventProxy(tbClientId.Text); proxy.EventDispatched += new EventHandler<EventDispatchedEventArgs>(proxy_EventDispatched); service.DispatchCall(proxy, "Hello World"); } catch (RemotingException ex) { MessageBox.Show(this, ex.Message, "Error"); } } private void btnSend_Click(object sender, EventArgs e) { DispatchCall(); } private void FormMain_Load(object sender, EventArgs e) { tbClientId.Text = Guid.NewGuid().ToString("N"); } private void InitializeClient() { ClientChannel channel = (ClientChannel)ChannelFactory.GetChannel( ChannelFactory.Type.Client); if (channel != null) { service = channel.Initialize(); } } private void proxy_EventDispatched(object sender, EventDispatchedEventArgs e) { SetText(string.Format("EventDispatched: {0}{1}", (string)e.Data, Environment.NewLine)); } private void SetText(string text) { // thread-safe call if (tbLog.InvokeRequired) { SetTextCallback d = new SetTextCallback(SetText); this.Invoke(d, new object[] { text }); } else { tbLog.AppendText(text); } } #endregion Methods } }
mit
C#
7cde3c6492f773a1d3cc294b587e75753e56b1ed
Update IDockerClient.cs
ahmetalpbalkan/Docker.DotNet
src/Docker.DotNet/IDockerClient.cs
src/Docker.DotNet/IDockerClient.cs
using System; namespace Docker.DotNet { public interface IDockerClient : IDisposable { DockerClientConfiguration Configuration { get; } TimeSpan DefaultTimeout { get; set; } #region Endpoints IContainerOperations Containers { get; } IImageOperations Images { get; } INetworkOperations Networks { get; } IVolumeOperations Volumes { get; } ISecretsOperations Secrets { get; } ISwarmOperations Swarm { get; } ITasksOperations Tasks { get; } ISystemOperations System { get; } IPluginOperations Plugin { get; } IExecOperations Exec { get; } #endregion Endpoints } }
using System; namespace Docker.DotNet { public interface IDockerClient : IDisposable { DockerClientConfiguration Configuration { get; } TimeSpan DefaultTimeout { get; set; } #region Endpoints IContainerOperations Containers { get; } IImageOperations Images { get; } INetworkOperations Networks { get; } IVolumeOperations Volumes { get; } ISecretsOperations Secrets { get; } ISwarmOperations Swarm { get; } ITasksOperations Tasks { get; } ISystemOperations System { get; } IPluginOperations Plugin { get; } #endregion Endpoints } }
apache-2.0
C#
a0dc3466b880ba36f39e4a4b8e55457236cfdec0
move to layout and material
ucdavis/Namster,ucdavis/Namster,ucdavis/Namster
src/Namster/Views/Home/List.cshtml
src/Namster/Views/Home/List.cshtml
@{ ViewData["Title"] = "List Results"; } <link href="//cdn.datatables.net/1.10.10/css/jquery.dataTables.min.css" rel="stylesheet" /> <div id="example"></div> @section scripts { <environment names="Development"> <script src="https://fb.me/react-0.14.3.js"></script> <script src="https://fb.me/react-dom-0.14.3.js"></script> </environment> <environment names="Staging,Production"> <script src="https://fb.me/react-0.14.3.min.js"></script> <script src="https://fb.me/react-dom-0.14.3.min.js"></script> </environment> <script src="//cdn.datatables.net/1.10.10/js/jquery.dataTables.min.js"></script> <script src="~/js/dist/list.js"></script> }
@model dynamic @{ Layout = null; } <html> <head> <title>List test</title> <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css"/> <link href="//cdn.datatables.net/1.10.10/css/jquery.dataTables.min.css" rel="stylesheet" /> @*<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script>*@ </head> <body> <div id="example"></div> <environment names="Development"> <script src="https://fb.me/react-0.14.3.js"></script> <script src="https://fb.me/react-dom-0.14.3.js"></script> </environment> <environment names="Staging,Production"> <script src="https://fb.me/react-0.14.3.min.js"></script> <script src="https://fb.me/react-dom-0.14.3.min.js"></script> </environment> <script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-1.11.3.min.js"></script> <script src="//cdn.datatables.net/1.10.10/js/jquery.dataTables.min.js"></script> <script src="~/js/dist/list.js"></script> </body> </html>
mit
C#
91717c204c55f578f7122cd45d5c6956b83ad087
Update index.cshtml
reactiveui/website,reactiveui/website,reactiveui/website,reactiveui/website
input/contribute/operations/index.cshtml
input/contribute/operations/index.cshtml
Order: 100 --- @Html.Partial("_ChildPages") <script async class="speakerdeck-embed" data-slide="4" data-id="880cb5d4ec364909a1db5b5655aa9d37" data-ratio="1.33333333333333" src="//speakerdeck.com/assets/embed.js"></script>
Order: 100 --- @Html.Partial("_ChildPages")
mit
C#
aa469b012df78b8fe47e937bead78a411319fd53
rewrite filename to update.exe and pass along any additional arguments
ruisebastiao/Squirrel.Windows,sickboy/Squirrel.Windows,markwal/Squirrel.Windows,Katieleeb84/Squirrel.Windows,vaginessa/Squirrel.Windows,awseward/Squirrel.Windows,markwal/Squirrel.Windows,EdZava/Squirrel.Windows,jbeshir/Squirrel.Windows,EdZava/Squirrel.Windows,flagbug/Squirrel.Windows,NeilSorensen/Squirrel.Windows,BarryThePenguin/Squirrel.Windows,markuscarlen/Squirrel.Windows,Suninus/Squirrel.Windows,JonMartinTx/AS400Report,ChaseFlorell/Squirrel.Windows,Squirrel/Squirrel.Windows,markuscarlen/Squirrel.Windows,1gurucoder/Squirrel.Windows,vaginessa/Squirrel.Windows,Suninus/Squirrel.Windows,yovannyr/Squirrel.Windows,airtimemedia/Squirrel.Windows,akrisiun/Squirrel.Windows,jochenvangasse/Squirrel.Windows,bowencode/Squirrel.Windows,jochenvangasse/Squirrel.Windows,kenbailey/Squirrel.Windows,BarryThePenguin/Squirrel.Windows,Squirrel/Squirrel.Windows,BarryThePenguin/Squirrel.Windows,josenbo/Squirrel.Windows,NeilSorensen/Squirrel.Windows,awseward/Squirrel.Windows,JonMartinTx/AS400Report,aneeff/Squirrel.Windows,punker76/Squirrel.Windows,markwal/Squirrel.Windows,punker76/Squirrel.Windows,allanrsmith/Squirrel.Windows,hammerandchisel/Squirrel.Windows,ChaseFlorell/Squirrel.Windows,NeilSorensen/Squirrel.Windows,airtimemedia/Squirrel.Windows,GeertvanHorrik/Squirrel.Windows,Suninus/Squirrel.Windows,jochenvangasse/Squirrel.Windows,yovannyr/Squirrel.Windows,willdean/Squirrel.Windows,BloomBooks/Squirrel.Windows,yovannyr/Squirrel.Windows,sickboy/Squirrel.Windows,ruisebastiao/Squirrel.Windows,JonMartinTx/AS400Report,hammerandchisel/Squirrel.Windows,josenbo/Squirrel.Windows,sickboy/Squirrel.Windows,cguedel/Squirrel.Windows,airtimemedia/Squirrel.Windows,jbeshir/Squirrel.Windows,aneeff/Squirrel.Windows,GeertvanHorrik/Squirrel.Windows,ChaseFlorell/Squirrel.Windows,EdZava/Squirrel.Windows,Katieleeb84/Squirrel.Windows,Katieleeb84/Squirrel.Windows,bowencode/Squirrel.Windows,1gurucoder/Squirrel.Windows,kenbailey/Squirrel.Windows,josenbo/Squirrel.Windows,BloomBooks/Squirrel.Windows,willdean/Squirrel.Windows,aneeff/Squirrel.Windows,ruisebastiao/Squirrel.Windows,vaginessa/Squirrel.Windows,allanrsmith/Squirrel.Windows,flagbug/Squirrel.Windows,cguedel/Squirrel.Windows,markuscarlen/Squirrel.Windows,GeertvanHorrik/Squirrel.Windows,BloomBooks/Squirrel.Windows,punker76/Squirrel.Windows,allanrsmith/Squirrel.Windows,Squirrel/Squirrel.Windows,1gurucoder/Squirrel.Windows,jbeshir/Squirrel.Windows,willdean/Squirrel.Windows,flagbug/Squirrel.Windows,kenbailey/Squirrel.Windows,hammerandchisel/Squirrel.Windows,bowencode/Squirrel.Windows,awseward/Squirrel.Windows,cguedel/Squirrel.Windows
src/Squirrel/AssemblyExtensions.cs
src/Squirrel/AssemblyExtensions.cs
using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; namespace Squirrel { public static class AssemblyExtensions { public static Process Restart(this Assembly assembly, string[] arguments = null) { return ProcessStart(assembly, assembly.Location, arguments); } public static Process ProcessStart(this Assembly assembly, string exeName, string[] arguments = null) { return Process.Start(getProcessStartInfo(assembly, exeName, arguments)); } public static Process ProcessStart(this Assembly assembly, ProcessStartInfo psi) { var arguments = new List<string> { string.Format("--process-start=\"{0}\"", psi.FileName) }; psi.FileName = getUpdateExe(assembly); if (!string.IsNullOrEmpty(psi.Arguments)) { arguments.Add(string.Format("--process-start-args=\"{0}\"", string.Join(" ", psi.Arguments))); } psi.Arguments = string.Join(" ", arguments); return Process.Start(psi); } public static ProcessStartInfo ProcessStartGetInfo(this Assembly assembly, string exeName, string[] arguments = null) { return getProcessStartInfo(assembly, exeName, arguments); } static ProcessStartInfo getProcessStartInfo(Assembly assembly, string exeName, string[] arguments) { var psi = new List<string> { string.Format("--process-start=\"{0}\"", exeName) }; if (arguments != null && arguments.Length > 0) { psi.Add(string.Format("--process-start-args=\"{0}\"", string.Join(" ", arguments))); } return new ProcessStartInfo(getUpdateExe(assembly), string.Join(" ", psi)); } static string getUpdateExe(Assembly assembly) { var rootAppDir = Path.Combine(Path.GetDirectoryName(assembly.Location), "..\\Update.exe"); return rootAppDir; } } }
using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; namespace Squirrel { public static class AssemblyExtensions { public static Process Restart(this Assembly assembly, string[] arguments = null) { return ProcessStart(assembly, assembly.Location, arguments); } public static Process ProcessStart(this Assembly assembly, string exeName, string[] arguments = null) { return Process.Start(getProcessStartInfo(assembly, exeName, arguments)); } public static Process ProcessStart(this Assembly assembly, ProcessStartInfo psi) { psi.FileName = getUpdateExe(assembly); if (!string.IsNullOrEmpty(psi.Arguments)) { psi.Arguments = string.Format("--process-start-args=\"{0}\"", string.Join(" ", psi.Arguments)); } return Process.Start(psi); } public static ProcessStartInfo ProcessStartGetInfo(this Assembly assembly, string exeName, string[] arguments = null) { return getProcessStartInfo(assembly, exeName, arguments); } static ProcessStartInfo getProcessStartInfo(Assembly assembly, string exeName, string[] arguments) { var psi = new List<string> { string.Format("--process-start=\"{0}\"", exeName) }; if (arguments != null && arguments.Length > 0) { psi.Add(string.Format("--process-start-args=\"{0}\"", string.Join(" ", arguments))); } return new ProcessStartInfo(getUpdateExe(assembly), string.Join(" ", psi)); } static string getUpdateExe(Assembly assembly) { var rootAppDir = Path.Combine(Path.GetDirectoryName(assembly.Location), "..\\Update.exe"); return rootAppDir; } } }
mit
C#
428b6a9bbed35966a0822571d6cf4af167cb6a81
Fix hex conversion.
vcsjones/OpenVsixSignTool
src/OpenVsixSignTool.Core/HexHelpers.cs
src/OpenVsixSignTool.Core/HexHelpers.cs
using System; namespace OpenVsixSignTool.Core { internal static class HexHelpers { private static ReadOnlySpan<byte> LookupTable => new byte[] { (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5', (byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', }; public static bool TryHexEncode(ReadOnlySpan<byte> data, Span<char> buffer) { var charsRequired = data.Length * 2; if (buffer.Length < charsRequired) { return false; } for (int i = 0, j = 0; i < data.Length; i++, j += 2) { var value = data[i]; buffer[j] = (char)LookupTable[(value & 0xF0) >> 4]; buffer[j+1] = (char)LookupTable[value & 0x0F]; } return true; } } }
using System; namespace OpenVsixSignTool.Core { internal static class HexHelpers { private static ReadOnlySpan<byte> LookupTable => new byte[] { (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5', (byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'A', (byte)'B', (byte)'C', (byte)'E', (byte)'E', (byte)'F', }; public static bool TryHexEncode(ReadOnlySpan<byte> data, Span<char> buffer) { var charsRequired = data.Length * 2; if (buffer.Length < charsRequired) { return false; } for (int i = 0, j = 0; i < data.Length; i++, j += 2) { var value = data[i]; buffer[j] = (char)LookupTable[(value & 0xF0) >> 4]; buffer[j+1] = (char)LookupTable[value & 0x0F]; } return true; } } }
mit
C#
94f6764098dc88a0bb68ed9a4d46602badd0cec9
Update TriggerOfT.cs
wieslawsoltes/AvaloniaBehaviors,wieslawsoltes/AvaloniaBehaviors
src/Avalonia.Xaml.Interactivity/TriggerOfT.cs
src/Avalonia.Xaml.Interactivity/TriggerOfT.cs
using System; using System.ComponentModel; namespace Avalonia.Xaml.Interactivity { /// <summary> /// A base class for behaviors, implementing the basic plumbing of <seealso cref="ITrigger"/>. /// </summary> /// <typeparam name="T">The object type to attach to</typeparam> public abstract class Trigger<T> : Trigger where T : class, IAvaloniaObject { /// <summary> /// Gets the object to which this behavior is attached. /// </summary> public new T? AssociatedObject => base.AssociatedObject as T; /// <summary> /// Called after the behavior is attached to the <see cref="Behavior.AssociatedObject"/>. /// </summary> /// <remarks> /// Override this to hook up functionality to the <see cref="Behavior.AssociatedObject"/> /// </remarks> protected override void OnAttached() { base.OnAttached(); if (AssociatedObject is null && base.AssociatedObject is { }) { string actualType = base.AssociatedObject.GetType().FullName; string expectedType = typeof(T).FullName; string message = $"AssociatedObject is of type {actualType} but should be of type {expectedType}."; throw new InvalidOperationException(message); } } } }
using System; using System.ComponentModel; namespace Avalonia.Xaml.Interactivity { /// <summary> /// A base class for behaviors, implementing the basic plumbing of <seealso cref="ITrigger"/>. /// </summary> /// <typeparam name="T">The object type to attach to</typeparam> public abstract class Trigger<T> : Trigger where T : class, IAvaloniaObject { /// <summary> /// Gets the object to which this behavior is attached. /// </summary> public new T? AssociatedObject => base.AssociatedObject as T; /// <summary> /// Called after the behavior is attached to the <see cref="Behavior.AssociatedObject"/>. /// </summary> /// <remarks> /// Override this to hook up functionality to the <see cref="Behavior.AssociatedObject"/> /// </remarks> protected override void OnAttached() { base.OnAttached(); if (AssociatedObject is null && base.AssociatedObject is { }) { string actualType = base.AssociatedObject.GetType().FullName; string expectedType = typeof(T).FullName; string message = string.Format("AssociatedObject is of type {0} but should be of type {1}.", actualType, expectedType); throw new InvalidOperationException(message); } } } }
mit
C#
3449eae3d2e71a57f7878ddd1b990f6c946d8558
Add missing ConfigureAwait
lewishenson/FluentCineworld
src/FluentCineworld/Sites/SiteDetailsQuery.cs
src/FluentCineworld/Sites/SiteDetailsQuery.cs
using System; using System.Linq; using System.Net.Http; using System.Text.Json; using System.Threading.Tasks; namespace FluentCineworld.Sites { public class SiteDetailsQuery { private readonly IUriGenerator _uriGenerator; private readonly HttpClient _httpClient; public SiteDetailsQuery( IUriGenerator uriGenerator, HttpClient httpClient) { _uriGenerator = uriGenerator ?? throw new ArgumentNullException(nameof(uriGenerator)); _httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient)); } public async Task<SiteDetails> ExecuteAsync(Cinema cinema) { if (cinema == null) { throw new ArgumentNullException(nameof(cinema)); } var json = await this.GetJson().ConfigureAwait(false); var response = JsonSerializer.Deserialize<ResponseDto>(json); var allSites = response.Body.Cinemas.Select(this.Map).ToList(); var targetSite = allSites.SingleOrDefault(site => site.Id == cinema.Value); return targetSite; } private async Task<byte[]> GetJson() { var url = _uriGenerator.ForCinemaSites(); var json = await _httpClient.GetByteArrayAsync(url).ConfigureAwait(false); return json; } private SiteDetails Map(SiteDto siteDto) { return new SiteDetails { Address = siteDto.Address, DisplayName = siteDto.DisplayName, Id = Convert.ToInt32(siteDto.Id), Link = siteDto.Link }; } } }
using System; using System.Linq; using System.Net.Http; using System.Text.Json; using System.Threading.Tasks; namespace FluentCineworld.Sites { public class SiteDetailsQuery { private readonly IUriGenerator _uriGenerator; private readonly HttpClient _httpClient; public SiteDetailsQuery( IUriGenerator uriGenerator, HttpClient httpClient) { _uriGenerator = uriGenerator ?? throw new ArgumentNullException(nameof(uriGenerator)); _httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient)); } public async Task<SiteDetails> ExecuteAsync(Cinema cinema) { if (cinema == null) { throw new ArgumentNullException(nameof(cinema)); } var json = await this.GetJson(); var response = JsonSerializer.Deserialize<ResponseDto>(json); var allSites = response.Body.Cinemas.Select(this.Map).ToList(); var targetSite = allSites.SingleOrDefault(site => site.Id == cinema.Value); return targetSite; } private async Task<byte[]> GetJson() { var url = _uriGenerator.ForCinemaSites(); var json = await _httpClient.GetByteArrayAsync(url).ConfigureAwait(false); return json; } private SiteDetails Map(SiteDto siteDto) { return new SiteDetails { Address = siteDto.Address, DisplayName = siteDto.DisplayName, Id = Convert.ToInt32(siteDto.Id), Link = siteDto.Link }; } } }
mit
C#
9480f273d40d83aa6b00da59184f58b35a32a87a
Add back in the implementation for tracking begin and end request
zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,zanetdev/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype
src/Glimpse.Agent.Web/WebTelemetryListener.cs
src/Glimpse.Agent.Web/WebTelemetryListener.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Glimpse.Agent.Web.Messages; using Microsoft.AspNet.Http; using Microsoft.Framework.TelemetryAdapter; namespace Glimpse.Agent.Web { public class WebTelemetryListener { private readonly IAgentBroker _broker; private readonly IContextData<MessageContext> _contextData; public WebTelemetryListener(IAgentBroker broker, IContextData<MessageContext> contextData) { _broker = broker; _contextData = contextData; } [TelemetryName("Microsoft.AspNet.Hosting.BeginRequest")] public void OnBeginRequest(HttpContext httpContext) { // TODO: Not sure if this is where this should live but it's the earlist hook point we have _contextData.Value = new MessageContext { Id = Guid.NewGuid(), Type = "Request" }; var request = httpContext.Request; var beginMessage = new BeginRequestMessage { // TODO: check if there is a better way of doing this // TODO: should there be a StartTime property here? Url = $"{request.Scheme}://{request.Host}{request.PathBase}{request.Path}{request.QueryString}" }; _broker.BeginLogicalOperation(beginMessage); } [TelemetryName("Microsoft.AspNet.Hosting.EndRequest")] public void OnEndRequest(HttpContext httpContext) { var timing = _broker.EndLogicalOperation<BeginRequestMessage>().Timing; var request = httpContext.Request; var response = httpContext.Response; var endMessage = new EndRequestMessage { // TODO: check if there is a better way of doing this Url = $"{request.Scheme}://{request.Host}{request.PathBase}{request.Path}{request.QueryString}", Duration = timing.Elapsed.TotalMilliseconds, Method = request.Method, ContentType = response.ContentType, StatusCode = response.StatusCode, StartTime = timing.Start.ToUniversalTime(), EndTime = timing.End.ToUniversalTime() }; _broker.SendMessage(endMessage); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Glimpse.Agent.Web.Messages; using Microsoft.AspNet.Http; using Microsoft.Framework.TelemetryAdapter; namespace Glimpse.Agent.Web { public class WebTelemetryListener { private readonly IAgentBroker _broker; private readonly IContextData<MessageContext> _contextData; public WebTelemetryListener(IAgentBroker broker, IContextData<MessageContext> contextData) { _broker = broker; _contextData = contextData; } [TelemetryName("Microsoft.AspNet.Hosting.BeginRequest")] public void OnBeginRequest(HttpContext httpContext) { // TODO: Not sure if this is where this should live but it's the earlist hook point we have _contextData.Value = new MessageContext { Id = Guid.NewGuid(), Type = "Request" }; //var request = httpContext.Request; //var beginMessage = new BeginRequestMessage //{ // // TODO: check if there is a better way of doing this // // TODO: should there be a StartTime property here? // Url = $"{request.Scheme}://{request.Host}{request.PathBase}{request.Path}{request.QueryString}" //}; //_broker.BeginLogicalOperation(beginMessage); } [TelemetryName("Microsoft.AspNet.Hosting.EndRequest")] public void OnEndRequest(HttpContext httpContext) { var timing = _broker.EndLogicalOperation<BeginRequestMessage>().Timing; //var request = httpContext.Request; //var response = httpContext.Response; //var endMessage = new EndRequestMessage //{ // // TODO: check if there is a better way of doing this // Url = $"{request.Scheme}://{request.Host}{request.PathBase}{request.Path}{request.QueryString}", // Duration = timing.Elapsed.TotalMilliseconds, // Method = request.Method, // ContentType = response.ContentType, // StatusCode = response.StatusCode, // StartTime = timing.Start.ToUniversalTime(), // EndTime = timing.End.ToUniversalTime() //}; //_broker.SendMessage(endMessage); } } }
mit
C#
7635a5fc1d6cf2d644a2ca322ebc15efc4712bc6
Update UnixTimeConvert.cs
patchkit-net/patchkit-library-dotnet,patchkit-net/patchkit-library-dotnet
src/PatchKit.Api/Utilities/UnixTimeConvert.cs
src/PatchKit.Api/Utilities/UnixTimeConvert.cs
using System; namespace PatchKit.Api.Utilities { /// <summary> /// Utility for converting Unix time stamp. /// </summary> public static class UnixTimeConvert { /// <summary> /// Converts Unix time stamp to DateTime value. /// </summary> public static DateTime FromUnixTimeStamp(double unixTimeStamp) { var baseDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); baseDateTime = baseDateTime.AddSeconds(unixTimeStamp).ToLocalTime(); return baseDateTime; } /// <summary> /// Converts DateTime value to Unix time stamp. /// </summary> public static double ToUnixTimeStamp(DateTime dateTime) { var baseDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); var dateTimeUtc = TimeZoneInfo.ConvertTimeToUtc(dateTime); return (dateTimeUtc - baseDateTime).TotalSeconds; } } }
using System; namespace PatchKit.Api.Utilities { /// <summary> /// Utility for converting Unix time stamp. /// </summary> public static class UnixTimeConvert { /// <summary> /// Converts Unix time stamp to DateTime value. /// </summary> public static DateTime FromUnixTimeStamp(double unixTimeStamp) { var dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); dateTime = dateTime.AddSeconds(unixTimeStamp).ToLocalTime(); return dateTime; } /// <summary> /// Converts DateTime value to Unix time stamp. /// </summary> public static long ToUnixTimeStamp(DateTime dateTime) { return Convert.ToInt64((TimeZoneInfo.ConvertTimeToUtc(dateTime) - new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds); } } }
mit
C#
ea764f9e86c1e8a0827b4658e26c9b8a8bbd9f89
Set all values in AssemblyInfo
akamsteeg/SwissArmyKnife
src/SwissArmyKnife/Properties/AssemblyInfo.cs
src/SwissArmyKnife/Properties/AssemblyInfo.cs
using System; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("SwissArmyKnife")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SwissArmyKnife")] [assembly: AssemblyCopyright("Copyright © Alex Kamsteeg")] [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("755f796c-d8df-4592-a9b2-0beb761aa107")] // 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 is fully CSL compliant [assembly: CLSCompliant(true)]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("SwissArmyKnife")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SwissArmyKnife")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("755f796c-d8df-4592-a9b2-0beb761aa107")] // 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#
8269b60263ac95803851eab6273df7a94c7350de
Fix SampleBass potentially adding invalid memory pressure (#2797)
ppy/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,peppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework
osu.Framework/Audio/Sample/SampleBass.cs
osu.Framework/Audio/Sample/SampleBass.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 ManagedBass; using osu.Framework.Allocation; using System.Collections.Concurrent; using System.Runtime.InteropServices; using System.Threading.Tasks; using osu.Framework.Platform; namespace osu.Framework.Audio.Sample { internal sealed class SampleBass : Sample, IBassAudio { private volatile int sampleId; public override bool IsLoaded => sampleId != 0; private NativeMemoryTracker.NativeMemoryLease memoryLease; internal SampleBass(byte[] data, ConcurrentQueue<Task> customPendingActions = null, int concurrency = DEFAULT_CONCURRENCY) : base(concurrency) { if (customPendingActions != null) PendingActions = customPendingActions; if (data.Length > 0) { EnqueueAction(() => { sampleId = loadSample(data); memoryLease = NativeMemoryTracker.AddMemory(this, data.Length); }); } } protected override void Dispose(bool disposing) { if (IsLoaded) { Bass.SampleFree(sampleId); memoryLease?.Dispose(); } base.Dispose(disposing); } void IBassAudio.UpdateDevice(int deviceIndex) { if (IsLoaded) // counter-intuitively, this is the correct API to use to migrate a sample to a new device. Bass.ChannelSetDevice(sampleId, deviceIndex); } public int CreateChannel() => Bass.SampleGetChannel(sampleId); private int loadSample(byte[] data) { const BassFlags flags = BassFlags.Default | BassFlags.SampleOverrideLongestPlaying; if (RuntimeInfo.SupportsJIT) return Bass.SampleLoad(data, 0, data.Length, PlaybackConcurrency, flags); using (var handle = new ObjectHandle<byte[]>(data, GCHandleType.Pinned)) return Bass.SampleLoad(handle.Address, 0, data.Length, PlaybackConcurrency, flags); } } }
// 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 ManagedBass; using osu.Framework.Allocation; using System.Collections.Concurrent; using System.Runtime.InteropServices; using System.Threading.Tasks; using osu.Framework.Platform; namespace osu.Framework.Audio.Sample { internal sealed class SampleBass : Sample, IBassAudio { private volatile int sampleId; public override bool IsLoaded => sampleId != 0; private NativeMemoryTracker.NativeMemoryLease memoryLease; internal SampleBass(byte[] data, ConcurrentQueue<Task> customPendingActions = null, int concurrency = DEFAULT_CONCURRENCY) : base(concurrency) { if (customPendingActions != null) PendingActions = customPendingActions; EnqueueAction(() => { sampleId = loadSample(data); memoryLease = NativeMemoryTracker.AddMemory(this, data.Length); }); } protected override void Dispose(bool disposing) { if (IsLoaded) { Bass.SampleFree(sampleId); memoryLease?.Dispose(); } base.Dispose(disposing); } void IBassAudio.UpdateDevice(int deviceIndex) { if (IsLoaded) // counter-intuitively, this is the correct API to use to migrate a sample to a new device. Bass.ChannelSetDevice(sampleId, deviceIndex); } public int CreateChannel() => Bass.SampleGetChannel(sampleId); private int loadSample(byte[] data) { const BassFlags flags = BassFlags.Default | BassFlags.SampleOverrideLongestPlaying; if (RuntimeInfo.SupportsJIT) return Bass.SampleLoad(data, 0, data.Length, PlaybackConcurrency, flags); using (var handle = new ObjectHandle<byte[]>(data, GCHandleType.Pinned)) return Bass.SampleLoad(handle.Address, 0, data.Length, PlaybackConcurrency, flags); } } }
mit
C#
560a0174dff62173c2288a390a0324b9ddedfaf2
Make auto restart toggleable
NeoAdonis/osu,smoogipooo/osu,ppy/osu,smoogipoo/osu,ppy/osu,smoogipoo/osu,peppy/osu,peppy/osu-new,NeoAdonis/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,peppy/osu,ppy/osu
osu.Game/Rulesets/Mods/ModSuddenDeath.cs
osu.Game/Rulesets/Mods/ModSuddenDeath.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.Bindables; using osu.Framework.Graphics.Sprites; using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Mods { public abstract class ModSuddenDeath : Mod, IApplicableToHealthProcessor, IApplicableFailOverride { public override string Name => "Sudden Death"; public override string Acronym => "SD"; public override IconUsage? Icon => OsuIcon.ModSuddendeath; public override ModType Type => ModType.DifficultyIncrease; public override string Description => "Miss and fail."; public override double ScoreMultiplier => 1; public override bool Ranked => true; public override Type[] IncompatibleMods => new[] { typeof(ModNoFail), typeof(ModRelax), typeof(ModAutoplay) }; [SettingSource("Restart on fail", "Automatically restarts when failed.")] public BindableBool Restart { get; } = new BindableBool(); public bool PerformFail() => true; public bool RestartOnFail => Restart.Value; public void ApplyToHealthProcessor(HealthProcessor healthProcessor) { healthProcessor.FailConditions += FailCondition; } protected virtual bool FailCondition(HealthProcessor healthProcessor, JudgementResult result) => result.Type.AffectsCombo() && !result.IsHit; } }
// 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.Sprites; using osu.Game.Graphics; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Mods { public abstract class ModSuddenDeath : Mod, IApplicableToHealthProcessor, IApplicableFailOverride { public override string Name => "Sudden Death"; public override string Acronym => "SD"; public override IconUsage? Icon => OsuIcon.ModSuddendeath; public override ModType Type => ModType.DifficultyIncrease; public override string Description => "Miss and fail."; public override double ScoreMultiplier => 1; public override bool Ranked => true; public override Type[] IncompatibleMods => new[] { typeof(ModNoFail), typeof(ModRelax), typeof(ModAutoplay) }; public bool PerformFail() => true; public bool RestartOnFail => true; public void ApplyToHealthProcessor(HealthProcessor healthProcessor) { healthProcessor.FailConditions += FailCondition; } protected virtual bool FailCondition(HealthProcessor healthProcessor, JudgementResult result) => result.Type.AffectsCombo() && !result.IsHit; } }
mit
C#
a447f200958977b86129d5159edb9891fc6e2031
Fix formatting of `#nullable enable`
NeoAdonis/osu,UselessToucan/osu,peppy/osu,ppy/osu,peppy/osu,smoogipooo/osu,UselessToucan/osu,smoogipoo/osu,ppy/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu-new,NeoAdonis/osu,ppy/osu,smoogipoo/osu,UselessToucan/osu
osu.Game/Rulesets/Edit/BeatmapVerifierContext.cs
osu.Game/Rulesets/Edit/BeatmapVerifierContext.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.Beatmaps; #nullable enable namespace osu.Game.Rulesets.Edit { /// <summary> /// Represents the context provided by the beatmap verifier to the checks it runs. /// Contains information about what is being checked and how it should be checked. /// </summary> public class BeatmapVerifierContext { /// <summary> /// The playable beatmap instance of the current beatmap. /// </summary> public readonly IBeatmap Beatmap; /// <summary> /// The working beatmap instance of the current beatmap. /// </summary> public readonly IWorkingBeatmap WorkingBeatmap; /// <summary> /// The difficulty level which the current beatmap is considered to be. /// </summary> public DifficultyRating InterpretedDifficulty; public BeatmapVerifierContext(IBeatmap beatmap, IWorkingBeatmap workingBeatmap, DifficultyRating difficultyRating = DifficultyRating.ExpertPlus) { Beatmap = beatmap; WorkingBeatmap = workingBeatmap; InterpretedDifficulty = difficultyRating; } } }
// 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.Beatmaps; #nullable enable namespace osu.Game.Rulesets.Edit { /// <summary> /// Represents the context provided by the beatmap verifier to the checks it runs. /// Contains information about what is being checked and how it should be checked. /// </summary> public class BeatmapVerifierContext { /// <summary> /// The playable beatmap instance of the current beatmap. /// </summary> public readonly IBeatmap Beatmap; /// <summary> /// The working beatmap instance of the current beatmap. /// </summary> public readonly IWorkingBeatmap WorkingBeatmap; /// <summary> /// The difficulty level which the current beatmap is considered to be. /// </summary> public DifficultyRating InterpretedDifficulty; public BeatmapVerifierContext(IBeatmap beatmap, IWorkingBeatmap workingBeatmap, DifficultyRating difficultyRating = DifficultyRating.ExpertPlus) { Beatmap = beatmap; WorkingBeatmap = workingBeatmap; InterpretedDifficulty = difficultyRating; } } }
mit
C#
a88fd4f4a003c8ab79a253729ddf9d42a6fd8826
Teste do ambiente de CI.
mfpalladino/palla.labs.vdt,mfpalladino/palla.labs.vdt,mfpalladino/palla.labs.vdt
Server/src/Palla.Labs.Vdt.WebApi/Controllers/HealthCheckController.cs
Server/src/Palla.Labs.Vdt.WebApi/Controllers/HealthCheckController.cs
using System.Net; using System.Net.Http; using System.Web.Http; namespace Palla.Labs.Vdt.Controllers { public class HealthCheckController : ApiController { public HttpResponseMessage Get() { return Request.CreateResponse<string>(HttpStatusCode.OK, "Aparentemente está tudo ok (testando appveyor)..."); } } }
using System.Net; using System.Net.Http; using System.Web.Http; namespace Palla.Labs.Vdt.Controllers { public class HealthCheckController : ApiController { public HttpResponseMessage Get() { return Request.CreateResponse<string>(HttpStatusCode.OK, "Aparentemente está tudo ok..."); } } }
unlicense
C#
45d9781aa443b79c0faf1592df63fd52e63211a0
Increment version
KevinJump/jumps.umbraco.usync
jumps.umbraco.usync/Properties/AssemblyInfo.cs
jumps.umbraco.usync/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("jumps.umbraco.usync")] [assembly: AssemblyDescription("umbraco syncing thing")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("jumoo")] [assembly: AssemblyProduct("jumps.umbraco.usync")] [assembly: AssemblyCopyright("Copyright © 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("5ae248ed-5476-4404-a3a6-82bfa2d5a6ed")] // 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.6.0.0")] [assembly: AssemblyFileVersion("1.6.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("jumps.umbraco.usync")] [assembly: AssemblyDescription("umbraco syncing thing")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("jumoo")] [assembly: AssemblyProduct("jumps.umbraco.usync")] [assembly: AssemblyCopyright("Copyright © 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("5ae248ed-5476-4404-a3a6-82bfa2d5a6ed")] // 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.8.0")] [assembly: AssemblyFileVersion("1.5.8.0")]
mit
C#
69b36ae52d35c5f983040a28ae9365beed157e5a
Remove out of sync property
code4romania/anabi-gestiune-api,code4romania/anabi-gestiune-api,code4romania/anabi-gestiune-api
Anabi.DataAccess.Ef/DbModels/AssetDb.cs
Anabi.DataAccess.Ef/DbModels/AssetDb.cs
using Anabi.Common.Utils; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace Anabi.DataAccess.Ef.DbModels { [Table("Assets")] public class AssetDb : BaseEntity { [Required(ErrorMessage = Constants.NAME_NOT_EMPTY)] [StringLength(maximumLength: 100, MinimumLength = 1, ErrorMessage = Constants.NAME_MAX_LENGTH_100)] public string Name { get; set; } public int? AddressId { get; set; } public virtual AddressDb Address { get; set; } public int CategoryId { get; set; } public virtual CategoryDb Category { get; set; } [MaxLength(2000)] public string Description { get; set; } public int? DecisionId { get; set; } public virtual DecisionDb CurrentDecision { get; set; } [MaxLength(100, ErrorMessage = Constants.IDENTIFIER_MAX_LENGTH_100)] public string Identifier { get; set; } [Column(TypeName = "decimal(20, 2)")] public decimal? NecessaryVolume { get; set; } public virtual ICollection<HistoricalStageDb> HistoricalStages { get; set; } [Required] public bool IsDeleted { get; set; } public int? NrOfObjects { get; set; } [MaxLength(10, ErrorMessage = Constants.MEASUREUNIT_MAX_LENGTH_10)] public string MeasureUnit { get; set; } [MaxLength(2000, ErrorMessage = Constants.REMARKS_MAX_LENGTH_2000)] public string Remarks { get; set; } public virtual ICollection<AssetStorageSpaceDb> AssetsStorageSpaces { get; set; } public virtual ICollection<AssetDefendantDb> Defendants { get; set; } } }
using Anabi.Common.Utils; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace Anabi.DataAccess.Ef.DbModels { [Table("Assets")] public class AssetDb : BaseEntity { [Required(ErrorMessage = Constants.NAME_NOT_EMPTY)] [StringLength(maximumLength: 100, MinimumLength = 1, ErrorMessage = Constants.NAME_MAX_LENGTH_100)] public string Name { get; set; } public int? AddressId { get; set; } public virtual AddressDb Address { get; set; } public int CategoryId { get; set; } public virtual CategoryDb Category { get; set; } [MaxLength(2000)] public string Description { get; set; } public int? DecisionId { get; set; } public virtual DecisionDb CurrentDecision { get; set; } [MaxLength(100, ErrorMessage = Constants.IDENTIFIER_MAX_LENGTH_100)] public string Identifier { get; set; } [Column(TypeName = "decimal(20, 2)")] public decimal? NecessaryVolume { get; set; } public virtual ICollection<HistoricalStageDb> HistoricalStages { get; set; } [Required] public bool IsDeleted { get; set; } public int? NrOfObjects { get; set; } [MaxLength(10, ErrorMessage = Constants.MEASUREUNIT_MAX_LENGTH_10)] public string MeasureUnit { get; set; } [MaxLength(2000, ErrorMessage = Constants.REMARKS_MAX_LENGTH_2000)] public string Remarks { get; set; } public virtual ICollection<AssetStorageSpaceDb> AssetsStorageSpaces { get; set; } public virtual ICollection<AssetDefendantDb> Defendants { get; set; } [MaxLength(200)] public string MyString { get; set; } } }
mpl-2.0
C#
9029e7660061b8931b98cefad14903b3a5e6fb6f
Fix waypoint function
emazzotta/unity-tower-defense
Assets/Scripts/MetallKeferController.cs
Assets/Scripts/MetallKeferController.cs
using UnityEngine; using System.Collections; public class MetallKeferController : MonoBehaviour { private GameController gameController; private GameObject[] baseBuildable; private GameObject nextWaypiont; private int currentWaypointIndex = 0; private int movementSpeed = 2; void Start () { this.gameController = GameObject.FindObjectOfType<GameController>(); this.nextWaypiont = this.gameController.getWaypoints () [this.currentWaypointIndex]; this.setInitialPosition (); } void Update() { this.moveToNextWaypoint (); } void SetNextWaypoint() { if (this.currentWaypointIndex < this.gameController.getWaypoints ().Length - 1) { this.currentWaypointIndex += 1; this.nextWaypiont = this.gameController.getWaypoints () [this.currentWaypointIndex]; this.nextWaypiont.GetComponent<Renderer> ().material.color = this.getRandomColor(); } } private Color getRandomColor() { Color newColor = new Color( Random.value, Random.value, Random.value, 1.0f ); return newColor; } private void setInitialPosition() { this.transform.position = this.nextWaypiont.transform.position; } private void moveToNextWaypoint() { float step = movementSpeed * Time.deltaTime; this.transform.LookAt (this.nextWaypiont.transform); this.transform.position = Vector3.MoveTowards(transform.position, this.nextWaypiont.transform.position, step); this.SetNextWaypoint (); } }
using UnityEngine; using System.Collections; public class MetallKeferController : MonoBehaviour { private GameController gameController; private GameObject[] baseBuildable; private GameObject nextWaypiont; private int currentWaypointIndex = 0; private int movementSpeed = 2; void Start () { this.gameController = GameObject.FindObjectOfType<GameController>(); this.nextWaypiont = this.gameController.getWaypoints () [this.currentWaypointIndex]; this.setInitialWaypoint (); } void Update() { this.moveToNextWaypoint (); } void SetNextWaypoint() { if (this.currentWaypointIndex < this.gameController.getWaypoints ().Length - 1) { this.currentWaypointIndex += 1; this.nextWaypiont = this.gameController.getWaypoints () [this.currentWaypointIndex]; this.nextWaypiont.GetComponent<Renderer> ().material.color = this.getRandomColor(); } } private Color getRandomColor() { Color newColor = new Color( Random.value, Random.value, Random.value, 1.0f ); return newColor; } private void setInitialWaypoint() { this.transform.position = this.nextWaypiont.transform.position; } private void moveToNextWaypoint() { float step = movementSpeed * Time.deltaTime; this.transform.LookAt (this.nextWaypiont.transform); this.transform.position = Vector3.MoveTowards(transform.position, this.nextWaypiont.transform.position, step); this.SetNextWaypoint (); } }
mit
C#
f7c3a81b6324d142a6e46eaa39a604afdc0987da
Add fail safe lookAt function for MetallKefer
emazzotta/unity-tower-defense
Assets/Scripts/MetallKeferController.cs
Assets/Scripts/MetallKeferController.cs
using UnityEngine; using System.Collections; public class MetallKeferController : MonoBehaviour { private GameController gameController; private GameObject[] baseBuildable; private GameObject nextWaypiont; private float health; private int currentWaypointIndex = 0; private int movementSpeed = 2; void Start () { this.health = 100; this.gameController = GameObject.FindObjectOfType<GameController>(); this.nextWaypiont = this.gameController.getWaypoints () [this.currentWaypointIndex]; this.setInitialPosition (); } void Update() { this.moveToNextWaypoint (); if (this.transform.position.Equals( this.nextWaypiont.transform.position )) { this.SetNextWaypoint (); } } void SetNextWaypoint() { if (this.currentWaypointIndex < this.gameController.getWaypoints ().Length - 1) { this.currentWaypointIndex += 1; this.nextWaypiont = this.gameController.getWaypoints () [this.currentWaypointIndex]; this.nextWaypiont.GetComponent<Renderer> ().material.color = this.getRandomColor(); } } private Color getRandomColor() { Color newColor = new Color( Random.value, Random.value, Random.value, 1.0f ); return newColor; } private void setInitialPosition() { this.transform.position = this.nextWaypiont.transform.position; } private void moveToNextWaypoint() { float step = movementSpeed * Time.deltaTime; Vector3 lookRotation = this.nextWaypiont.transform.position - transform.position; if (lookRotation != Vector3.zero) { var targetRotation = Quaternion.LookRotation(lookRotation); transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, 5 * Time.deltaTime); this.transform.position = Vector3.MoveTowards(transform.position, this.nextWaypiont.transform.position, step); } } public void TakeDamage(float damage) { health -= damage; } }
using UnityEngine; using System.Collections; public class MetallKeferController : MonoBehaviour { private GameController gameController; private GameObject[] baseBuildable; private GameObject nextWaypiont; private float health; private int currentWaypointIndex = 0; private int movementSpeed = 2; void Start () { this.health = 100; this.gameController = GameObject.FindObjectOfType<GameController>(); this.nextWaypiont = this.gameController.getWaypoints () [this.currentWaypointIndex]; this.setInitialPosition (); } void Update() { this.moveToNextWaypoint (); if (this.transform.position.Equals( this.nextWaypiont.transform.position )) { this.SetNextWaypoint (); } } void SetNextWaypoint() { if (this.currentWaypointIndex < this.gameController.getWaypoints ().Length - 1) { this.currentWaypointIndex += 1; this.nextWaypiont = this.gameController.getWaypoints () [this.currentWaypointIndex]; this.nextWaypiont.GetComponent<Renderer> ().material.color = this.getRandomColor(); } } private Color getRandomColor() { Color newColor = new Color( Random.value, Random.value, Random.value, 1.0f ); return newColor; } private void setInitialPosition() { this.transform.position = this.nextWaypiont.transform.position; } private void moveToNextWaypoint() { float step = movementSpeed * Time.deltaTime; var targetRotation = Quaternion.LookRotation(this.nextWaypiont.transform.position - transform.position); transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, 5 * Time.deltaTime); this.transform.position = Vector3.MoveTowards(transform.position, this.nextWaypiont.transform.position, step); } public void TakeDamage(float damage) { health -= damage; } }
mit
C#
1e568afc83db1ca98b9b88faf4d82ff48852496f
Bump version
nixxquality/GitHubUpdate
GitHubUpdate/Properties/AssemblyInfo.cs
GitHubUpdate/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Resources; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("GitHub Update Check")] [assembly: AssemblyDescription("Easily check if your program is up to date, using GitHub Releases")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("nixx quality")] [assembly: AssemblyProduct("GitHubUpdate")] [assembly: AssemblyCopyright("Copyright © nixx quality 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("747a3829-ff9f-461e-8dbb-e606e98fa25e")] // 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.1")] [assembly: NeutralResourcesLanguageAttribute("en")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Resources; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("GitHub Update Check")] [assembly: AssemblyDescription("Easily check if your program is up to date, using GitHub Releases")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("nixx quality")] [assembly: AssemblyProduct("GitHubUpdate")] [assembly: AssemblyCopyright("Copyright © nixx quality 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("747a3829-ff9f-461e-8dbb-e606e98fa25e")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: NeutralResourcesLanguageAttribute("en")]
mit
C#
e84652c31c1f3ef16e370b2e35a6410fb5dee796
fix assemblyinfo
Ar3sDevelopment/Json.NET.Web
Json.NET.Web/Properties/AssemblyInfo.cs
Json.NET.Web/Properties/AssemblyInfo.cs
using System.Resources; 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("Json.NET.Web")] [assembly: AssemblyDescription("Json.NET web client")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Caelan")] [assembly: AssemblyProduct("Json.NET.Web")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.*")]
using System.Resources; 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("Json.NET.Web")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Json.NET.Web")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
3ecff370781d326e7f80ca7270ec0331b5fe7f95
bump version number to 1.5.5
martin2250/OpenCNCPilot
OpenCNCPilot/Properties/AssemblyInfo.cs
OpenCNCPilot/Properties/AssemblyInfo.cs
using System.Reflection; 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("OpenCNCPilot")] [assembly: AssemblyDescription("GCode Sender and AutoLeveller")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("martin2250")] [assembly: AssemblyProduct("OpenCNCPilot")] [assembly: AssemblyCopyright("Copyright ©martin2250 2018")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.5.5.0")] [assembly: AssemblyFileVersion("1.5.5.0")]
using System.Reflection; 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("OpenCNCPilot")] [assembly: AssemblyDescription("GCode Sender and AutoLeveller")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("martin2250")] [assembly: AssemblyProduct("OpenCNCPilot")] [assembly: AssemblyCopyright("Copyright ©martin2250 2018")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.5.4.0")] [assembly: AssemblyFileVersion("1.5.4.0")]
mit
C#
b4d77b35eebaa1bc427b86258653b74822ed89a8
Update GameManager.cs
afroraydude/First_Unity_Game,afroraydude/First_Unity_Game,afroraydude/First_Unity_Game
Real_Game/Assets/Scripts/GameManager.cs
Real_Game/Assets/Scripts/GameManager.cs
using UnityEngine; using System.Collections; public class GameManager : MonoBehaviour { // Score based stuff public float highScore = 0f; // Level based stuff public int currentLevel = 0; public int unlockedLevels; public int LevelGradingID = 6; // Things that deal with GUI or whatever public Rect stopwatchRect; public Rect stopwatchBoxRect; public Rect highScoreRect; public Rect highScoreBox; public GUISkin skin; // Stuff that deals with the ingame stopwatch, which is my answer to the score system. public float startTime; private string currentTime; public string highTime; // Once the level loads this happens void Start() { // DontDestroyOnLoad(gameObject); /** * * if (PlayerPrefs.GetInt("LevelsCompleted") > 0) { currentLevel = PlayerPrefs.GetInt("LevelsCompleted"); * } * else * { currentLevel = 0; * } */ } // This is ran every tick void Update() { //This records the time it took to complete the level startTime += Time.deltaTime; //This puts it into a string so that it can be viewed on the GUI currentTime = string.Format ("{0:0.0}", startTime); } // GUI goes here void OnGUI() { GUI.skin = skin; GUI.Box (stopwatchBoxRect, ""); GUI.Label(stopwatchRect, currentTime, skin.GetStyle ("Stopwatch")); GUI.Label (highScoreRect, PlayerPrefs.GetString("Level" + currentLevel.ToString() + "Score")); GUI.Box (highScoreBox, ""); } public void MainMenuToLevelOne() { currentLevel = 1; PlayerPrefs.SetInt("LevelsCompleted", currentLevel); PlayerPrefs.Save(); Application.LoadLevel(currentLevel); } public void BackToMainMenu() { currentLevel = 0; Application.LoadLevel(currentLevel); } // For when the player completes a level // TODO: Fix issue in flash were it does not care if the high score is > or < the startTime, it always overrides it. public void CompleteLevel() { unlockedLevels = PlayerPrefs.GetInt("LevelsCompleted"); if(highScore > startTime || highScore == 0) { highScore = startTime; highTime = string.Format ("{0:0.0}", highScore); PlayerPrefs.SetString("Level" + currentLevel.ToString() + "Score", highTime); } if (currentLevel < 5) { if (unlockedLevels < currentLevel) { PlayerPrefs.SetInt("LevelsCompleted", currentLevel); PlayerPrefs.GetInt("LevelsCompleted"); PlayerPrefs.Save(); } Application.LoadLevel(LevelGradingID); } else { print ("Please increase level amount."); } } // After LevelGrading is done, this happens public void AfterGrading() { currentLevel +=1; Application.LoadLevel(currentLevel); } public void StartGame() { currentLevel = 0; } }
using UnityEngine; using System.Collections; public class GameManager : MonoBehaviour { // Score based stuff public float highScore = 0f; //Level based stuff public int currentLevel = 0; public int unlockedLevels; public int LevelGradingID = 6; // Things that deal with GUI or whatever public Rect stopwatchRect; public Rect stopwatchBoxRect; public Rect highScoreRect; public Rect highScoreBox; public GUISkin skin; // Stuff that deals with the ingame stopwatch, which is my answer to the score system. public float startTime; private string currentTime; public string highTime; // Once the level loads this happens void Start() { // DontDestroyOnLoad(gameObject); /** * * if (PlayerPrefs.GetInt("LevelsCompleted") > 0) { currentLevel = PlayerPrefs.GetInt("LevelsCompleted"); * } * else * { currentLevel = 0; * } */ } // This is ran every tick void Update() { //This records the time it took to complete the level startTime += Time.deltaTime; //This puts it into a string so that it can be viewed on the GUI currentTime = string.Format ("{0:0.0}", startTime); } // GUI goes here void OnGUI() { GUI.skin = skin; GUI.Box (stopwatchBoxRect, ""); GUI.Label(stopwatchRect, currentTime, skin.GetStyle ("Stopwatch")); GUI.Label (highScoreRect, PlayerPrefs.GetString("Level" + currentLevel.ToString() + "Score")); GUI.Box (highScoreBox, ""); } /** * Alternative to the Maine Menu having to save information */ void MainMenuToLevelOne() { currentLevel = 1; PlayerPrefs.SetInt("LevelsCompleted", currentLevel); PlayerPrefs.Save(); Application.LoadLevel(currentLevel); } void BackToMainMenu() { currentLevel = 0; Application.LoadLevel(currentLevel); } // For when the player completes a level // TODO: Fix issue in flash were it does not care if the high score is > or < the startTime, it always overrides it. void CompleteLevel() { unlockedLevels = PlayerPrefs.GetInt("LevelsCompleted"); if(highScore > startTime || highScore == 0) { highScore = startTime; highTime = string.Format ("{0:0.0}", highScore); PlayerPrefs.SetString("Level" + currentLevel.ToString() + "Score", highTime); } if (currentLevel < 5) { if (unlockedLevels < currentLevel) { PlayerPrefs.SetInt("LevelsCompleted", currentLevel); PlayerPrefs.GetInt("LevelsCompleted"); PlayerPrefs.Save(); } Application.LoadLevel(LevelGradingID); } else { print ("Please increase level amount."); } } void AfterGrading() { currentLevel +=1; Application.LoadLevel(currentLevel); } void StartGame() { currentLevel = 0; } }
mit
C#
169a8a51f44ff9985a01d4f10fd8c9b16a32230b
Handle MouseLeave event
sakapon/Samples-2014,sakapon/Samples-2014,sakapon/Samples-2014
RxSample/MouseOldWpf/MainWindow.xaml.cs
RxSample/MouseOldWpf/MainWindow.xaml.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace MouseOldWpf { /// <summary> /// MainWindow.xaml の相互作用ロジック /// </summary> public partial class MainWindow : Window { public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register("Orientation", typeof(string), typeof(MainWindow), new PropertyMetadata(null)); public string Orientation { get { return (string)GetValue(OrientationProperty); } private set { SetValue(OrientationProperty, value); } } public MainWindow() { InitializeComponent(); var π = Math.PI; var orientationSymbols = new[] { "→", "↘", "↓", "↙", "←", "↖", "↑", "↗" }; var zoneAngleRange = 2 * π / orientationSymbols.Length; var start = default(Point?); MouseDown += (o, e) => { start = e.GetPosition(this); }; MouseUp += (o, e) => { if (!start.HasValue) return; var end = e.GetPosition(this); var _ = new { Start = start.Value, End = end }; Debug.WriteLine(_); var d = _.End - _.Start; if (d.Length < 100) return; var angle = 2 * π + Math.Atan2(d.Y, d.X); var zone = (int)Math.Round(angle / zoneAngleRange) % orientationSymbols.Length; Orientation = orientationSymbols[zone]; }; MouseLeave += (o, e) => { start = null; }; } } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace MouseOldWpf { /// <summary> /// MainWindow.xaml の相互作用ロジック /// </summary> public partial class MainWindow : Window { public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register("Orientation", typeof(string), typeof(MainWindow), new PropertyMetadata(null)); public string Orientation { get { return (string)GetValue(OrientationProperty); } private set { SetValue(OrientationProperty, value); } } public MainWindow() { InitializeComponent(); var π = Math.PI; var orientationSymbols = new[] { "→", "↘", "↓", "↙", "←", "↖", "↑", "↗" }; var zoneAngleRange = 2 * π / orientationSymbols.Length; var start = default(Point); MouseDown += (o, e) => { start = e.GetPosition(this); }; MouseUp += (o, e) => { var end = e.GetPosition(this); Debug.WriteLine(new { Start = start, End = end }); var d = end - start; if (d.Length < 100) return; var angle = 2 * π + Math.Atan2(d.Y, d.X); var zone = (int)Math.Round(angle / zoneAngleRange) % orientationSymbols.Length; Orientation = orientationSymbols[zone]; }; } } }
mit
C#
46f0df7bc0be14da3f2a955bbaadb43e84972da0
Set title of root controller (sample app)
Microsoft/ApplicationInsights-Xamarin
SampleApp/ExampleTableViewController.cs
SampleApp/ExampleTableViewController.cs
using Foundation; using System; using System.CodeDom.Compiler; using UIKit; namespace SampleApp { partial class ExampleTableViewController : UITableViewController { public ExampleTableViewController (IntPtr handle) : base (handle) { } public override void ViewDidLoad () { base.ViewDidLoad (); Title = "Application Insights Xamarin"; TableView.Source = new ExampleTableViewControllerSource(NavigationController); } } }
using Foundation; using System; using System.CodeDom.Compiler; using UIKit; namespace SampleApp { partial class ExampleTableViewController : UITableViewController { public ExampleTableViewController (IntPtr handle) : base (handle) { } public override void ViewDidLoad () { base.ViewDidLoad (); TableView.Source = new ExampleTableViewControllerSource(NavigationController); } } }
mit
C#
4e7da67558eda4f696dad0a5a15f44668bfc45c1
Remove useless if check
ThomasNigro/ScrollWatchedSelector,ThomasNigro/ScrollWatcher
ScrollWatchedListView/SelectorHelper.cs
ScrollWatchedListView/SelectorHelper.cs
using System; using Windows.UI.Xaml.Controls; using WinRTXamlToolkit.Controls.Extensions; namespace ScrollWatchedSelector { public static class SelectorHelper { private static IScrollWatchedSelector _scrollWatchedSelector; public static ScrollViewer RegisterScrollViewer(ItemsControl selector, IScrollWatchedSelector scrollWatchedSelector) { _scrollWatchedSelector = scrollWatchedSelector; ScrollViewer sV = null; sV = selector.GetFirstDescendantOfType<ScrollViewer>(); sV.ViewChanging += ScrollViewerOnViewChanging; return sV; } public static void ScrollViewerOnViewChanging(object sender, ScrollViewerViewChangingEventArgs scrollViewerViewChangingEventArgs) { var voffset = scrollViewerViewChangingEventArgs.NextView.VerticalOffset; if (voffset < 50 || voffset > (_scrollWatchedSelector.scrollViewer.ScrollableHeight - 50)) return; if (voffset > _scrollWatchedSelector.scroll + 30) { // Scrolling to bottom if (_scrollWatchedSelector.scrollingType != ScrollingType.ToBottom) { _scrollWatchedSelector.scrollingType = ScrollingType.ToBottom; ScrollingEventArgs e = new ScrollingEventArgs(_scrollWatchedSelector.scrollingType); _scrollWatchedSelector.InvokeScrollingEvent(e); } _scrollWatchedSelector.scroll = voffset; } else if (voffset < _scrollWatchedSelector.scroll - 30) { // Scrolling to top if (_scrollWatchedSelector.scrollingType != ScrollingType.ToTop) { _scrollWatchedSelector.scrollingType = ScrollingType.ToTop; ScrollingEventArgs e = new ScrollingEventArgs(_scrollWatchedSelector.scrollingType); _scrollWatchedSelector.InvokeScrollingEvent(e); } _scrollWatchedSelector.scroll = voffset; } } } }
using System; using Windows.UI.Xaml.Controls; using WinRTXamlToolkit.Controls.Extensions; namespace ScrollWatchedSelector { public static class SelectorHelper { private static IScrollWatchedSelector _scrollWatchedSelector; public static ScrollViewer RegisterScrollViewer(ItemsControl selector, IScrollWatchedSelector scrollWatchedSelector) { _scrollWatchedSelector = scrollWatchedSelector; ScrollViewer sV = null; sV = selector.GetFirstDescendantOfType<ScrollViewer>(); sV.ViewChanging += ScrollViewerOnViewChanging; return sV; } public static void ScrollViewerOnViewChanging(object sender, ScrollViewerViewChangingEventArgs scrollViewerViewChangingEventArgs) { var voffset = scrollViewerViewChangingEventArgs.NextView.VerticalOffset; if (voffset < 50 || voffset > (_scrollWatchedSelector.scrollViewer.ScrollableHeight - 50)) return; if (voffset > _scrollWatchedSelector.scroll + 30) { // Scrolling to bottom if (_scrollWatchedSelector.scrollingType != ScrollingType.ToBottom) { _scrollWatchedSelector.scrollingType = ScrollingType.ToBottom; ScrollingEventArgs e = new ScrollingEventArgs(_scrollWatchedSelector.scrollingType); _scrollWatchedSelector.InvokeScrollingEvent(e); } } else if (voffset < _scrollWatchedSelector.scroll - 30) { // Scrolling to top if (_scrollWatchedSelector.scrollingType != ScrollingType.ToTop) { _scrollWatchedSelector.scrollingType = ScrollingType.ToTop; ScrollingEventArgs e = new ScrollingEventArgs(_scrollWatchedSelector.scrollingType); _scrollWatchedSelector.InvokeScrollingEvent(e); } } if (Math.Abs(_scrollWatchedSelector.scroll - voffset) > 30) _scrollWatchedSelector.scroll = voffset; } } }
mit
C#
00bbd698ebcfed09ed11eb464bc0e4b91b162866
bump up version number to be able to deploy a successful manual
PapaMufflon/StandUpTimer,PapaMufflon/StandUpTimer,PapaMufflon/StandUpTimer
StandUpTimer/Properties/AssemblyInfo.cs
StandUpTimer/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; [assembly: AssemblyVersion("0.8.8")] [assembly: AssemblyFileVersion("0.8.8")] [assembly: InternalsVisibleTo("StandUpTimer.UnitTests")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
using System.Reflection; using System.Runtime.CompilerServices; [assembly: AssemblyVersion("0.8.7")] [assembly: AssemblyFileVersion("0.8.7")] [assembly: InternalsVisibleTo("StandUpTimer.UnitTests")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
mit
C#
fc1075b28377b546ac2fc1c067b072d810dedc99
Add informational version to assembly manifest
elcattivo/CloudFlareUtilities
CloudFlareUtilities/Properties/AssemblyInfo.cs
CloudFlareUtilities/Properties/AssemblyInfo.cs
using System; using System.Resources; 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("CloudFlare Utilities")] [assembly: AssemblyDescription("A .NET PCL to bypass Cloudflare's Anti-DDoS measure (JavaScript challenge) using a DelegatingHandler.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("El Cattivo")] [assembly: AssemblyProduct("CloudFlare Utilities")] [assembly: AssemblyCopyright("Copyright © El Cattivo 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] [assembly: AssemblyVersion("0.1.0.0")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0.0-alpha")] [assembly:CLSCompliant(true)] [assembly:ComVisible(false)] [assembly: InternalsVisibleTo("CloudFlareUtilities.Tests")]
using System; using System.Resources; 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("CloudFlare Utilities")] [assembly: AssemblyDescription("A .NET PCL to bypass Cloudflare's Anti-DDoS measure (JavaScript challenge) using a DelegatingHandler.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("El Cattivo")] [assembly: AssemblyProduct("CloudFlare Utilities")] [assembly: AssemblyCopyright("Copyright © El Cattivo 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.1.0.0")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly:CLSCompliant(true)] [assembly:ComVisible(false)] [assembly: InternalsVisibleTo("CloudFlareUtilities.Tests")]
mit
C#
36c5ab551d96137054408809be389c39edad9554
Fix mobs not dropping items when falling down. (#5771)
space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14
Content.Server/Standing/StandingStateSystem.cs
Content.Server/Standing/StandingStateSystem.cs
using Content.Server.Hands.Components; using Content.Shared.Standing; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Maths; using Robust.Shared.Random; namespace Content.Server.Standing; public class StandingStateSystem : EntitySystem { [Dependency] private readonly IRobustRandom _random = default!; private void FallOver(EntityUid uid, StandingStateComponent component, DropHandItemsEvent args) { var direction = EntityManager.TryGetComponent(uid, out PhysicsComponent? comp) ? comp.LinearVelocity / 50 : Vector2.Zero; var dropAngle = _random.NextFloat(0.8f, 1.2f); if (!EntityManager.TryGetComponent(uid, out HandsComponent? hands)) return; foreach (var heldItem in hands.GetAllHeldItems()) { if (!hands.Drop(heldItem.Owner, false)) continue; var worldRotation = EntityManager.GetComponent<TransformComponent>(uid).WorldRotation.ToVec(); Throwing.ThrowHelper.TryThrow(heldItem.Owner, _random.NextAngle().RotateVec(direction / dropAngle + worldRotation / 50), 0.5f * dropAngle * _random.NextFloat(-0.9f, 1.1f), uid, 0); } } public override void Initialize() { base.Initialize(); SubscribeLocalEvent<StandingStateComponent, DropHandItemsEvent>(FallOver); } }
using Content.Server.Hands.Components; using Content.Shared.Standing; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Maths; using Robust.Shared.Random; namespace Content.Server.Standing; public class StandingStateSystem : EntitySystem { [Dependency] private readonly IRobustRandom _random = default!; private void FallOver(EntityUid uid, StandingStateComponent component, DropHandItemsEvent args) { var direction = EntityManager.TryGetComponent(uid, out PhysicsComponent? comp) ? comp.LinearVelocity / 50 : Vector2.Zero; var dropAngle = _random.NextFloat(0.8f, 1.2f); if (!EntityManager.TryGetComponent(uid, out HandsComponent? hands)) return; foreach (var heldItem in hands.GetAllHeldItems()) { if (!hands.Drop(heldItem.Owner)) continue; var worldRotation = EntityManager.GetComponent<TransformComponent>(uid).WorldRotation.ToVec(); Throwing.ThrowHelper.TryThrow(heldItem.Owner, _random.NextAngle().RotateVec(direction / dropAngle + worldRotation / 50), 0.5f * dropAngle * _random.NextFloat(-0.9f, 1.1f), uid, 0); } } public override void Initialize() { base.Initialize(); SubscribeLocalEvent<StandingStateComponent, DropHandItemsEvent>(FallOver); } }
mit
C#
49c2d6875affe1a0124f3a8a255aaacc094afb3f
Update FormationAnimationTrigger.cs
Goodgulf281/Unity-Formation-Movement
Scripts/Formation/FormationAnimationTrigger.cs
Scripts/Formation/FormationAnimationTrigger.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; //using Pathfinding.Util; // Code from A*Pathfinding using com.t7t.utilities; namespace com.t7t.formation { public class FormationAnimationTrigger : MonoBehaviour { [SerializeField] float period = 0.8F; // Checks every period seconds if a formation is in range [SerializeField] float range = 5.0F; [SerializeField] bool drawGizmos = true; [Header("Animation")] [SerializeField] Animator animator; [SerializeField] string animationParameter; [SerializeField] bool newState = true; private float time = 0.0f; private Toolbox toolbox; private void Awake() { toolbox = Toolbox.Instance; } // Use this for initialization void Start() { } // Update is called once per frame void Update() { time += Time.deltaTime; if (time >= period) { time = 0.0f; // check if a formation is now in range for (int i = 0; i < toolbox.allFormations.Count; i++) { FormationGrid fg = toolbox.allFormations[i]; //Debug.Log(Vector3.Distance(fg.transform.position, transform.position)); if (Vector3.Distance(fg.transform.position, transform.position) < range) { animator.SetBool(animationParameter, newState); } } } } void OnDrawGizmosSelected() { if (drawGizmos) { // Draw.Gizmos.CircleXZ(transform.position, range, Color.yellow); } } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; using Pathfinding.Util; using com.t7t.utilities; namespace com.t7t.formation { public class FormationAnimationTrigger : MonoBehaviour { [SerializeField] float period = 0.8F; // Checks every period seconds if a formation is in range [SerializeField] float range = 5.0F; [SerializeField] bool drawGizmos = true; [Header("Animation")] [SerializeField] Animator animator; [SerializeField] string animationParameter; [SerializeField] bool newState = true; private float time = 0.0f; private Toolbox toolbox; private void Awake() { toolbox = Toolbox.Instance; } // Use this for initialization void Start() { } // Update is called once per frame void Update() { time += Time.deltaTime; if (time >= period) { time = 0.0f; // check if a formation is now in range for (int i = 0; i < toolbox.allFormations.Count; i++) { FormationGrid fg = toolbox.allFormations[i]; //Debug.Log(Vector3.Distance(fg.transform.position, transform.position)); if (Vector3.Distance(fg.transform.position, transform.position) < range) { animator.SetBool(animationParameter, newState); } } } } void OnDrawGizmosSelected() { if (drawGizmos) { Draw.Gizmos.CircleXZ(transform.position, range, Color.yellow); } } } }
mit
C#
fc97329c154303ed188ebac28dc4877451d522a0
Fix key binding
eivindveg/PG3300-Innlevering1
SnakeMessModelsLib/GeneratedCode/KeyMapping.cs
SnakeMessModelsLib/GeneratedCode/KeyMapping.cs
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool // Changes to this file will be lost if the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Input; public class KeyMapping { private ConsoleKey up { get; set; } private ConsoleKey down { get; set; } private ConsoleKey left { get; set; } private ConsoleKey right { get; set; } }
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool // Changes to this file will be lost if the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Input; public class KeyMapping { private Key up { get; set; } private Key down { get; set; } private Key left { get; set; } private Key right { get; set; } }
mit
C#
18b987615a5074300be1908e357870523c870e92
Add menu items for additional actions.
tvanfosson/azure-web-jobs-demo,tvanfosson/azure-web-jobs-demo,tvanfosson/azure-web-jobs-demo
WebJobsDemo/WebApp/Views/Shared/_Layout.cshtml
WebJobsDemo/WebApp/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 - WebJob Demos</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("WebJobs Demo", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" }) @Html.ActionLink("WebJobs Demo", "Subscribe", "Home", new { area = "" }, new { @class = "navbar-brand" }) @Html.ActionLink("WebJobs Demo", "Subscribed", "Home", new { area = "" }, new { @class = "navbar-brand" }) @Html.ActionLink("WebJobs Demo", "WebHooks", "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> </ul> </div> </div> </div> <div class="container body-content"> @RenderBody() <hr /> <footer> <p>&copy; @DateTime.Now.Year - Tim VanFosson</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 - WebJob Demos</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("WebJobs Demo", "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> </ul> </div> </div> </div> <div class="container body-content"> @RenderBody() <hr /> <footer> <p>&copy; @DateTime.Now.Year - Tim VanFosson</p> </footer> </div> @Scripts.Render("~/bundles/jquery") @Scripts.Render("~/bundles/bootstrap") @RenderSection("scripts", required: false) </body> </html>
mit
C#
4e1c5bce3dd7183951c218d7bc9c21f0caf4ff27
Add region tags for sample.
GoogleCloudPlatform/getting-started-dotnet,GoogleCloudPlatform/getting-started-dotnet,GoogleCloudPlatform/getting-started-dotnet
aspnet/1-hello-world/App_Start/WebApiConfig.cs
aspnet/1-hello-world/App_Start/WebApiConfig.cs
// Copyright(c) 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not // use this file except in compliance with the License. You may obtain a copy of // the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the // License for the specific language governing permissions and limitations under // the License. using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Web.Http; using System.Web.Http.Routing; namespace GoogleCloudSamples { public static class WebApiConfig { // [START sample] /// <summary> /// The simplest possible HTTP Handler that just returns "Hello World." /// </summary> public class HelloWorldHandler : HttpMessageHandler { protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { return Task.FromResult(new HttpResponseMessage() { Content = new ByteArrayContent(Encoding.UTF8.GetBytes("Hello World.")) }); } }; public static void Register(HttpConfiguration config) { var emptyDictionary = new HttpRouteValueDictionary(); // Add our one HttpMessageHandler to the root path. config.Routes.MapHttpRoute("index", "", emptyDictionary, emptyDictionary, new HelloWorldHandler()); } // [END sample] } }
// Copyright(c) 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not // use this file except in compliance with the License. You may obtain a copy of // the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the // License for the specific language governing permissions and limitations under // the License. using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Web.Http; using System.Web.Http.Routing; namespace GoogleCloudSamples { public static class WebApiConfig { /// <summary> /// The simplest possible HTTP Handler that just returns "Hello World." /// </summary> public class HelloWorldHandler : HttpMessageHandler { protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { return Task.FromResult(new HttpResponseMessage() { Content = new ByteArrayContent(Encoding.UTF8.GetBytes("Hello World.")) }); } }; public static void Register(HttpConfiguration config) { var emptyDictionary = new HttpRouteValueDictionary(); // Add our one HttpMessageHandler to the root path. config.Routes.MapHttpRoute("index", "", emptyDictionary, emptyDictionary, new HelloWorldHandler()); } } }
apache-2.0
C#
a02539f6fcc31ad2c59982ae35759dbd0af67bcc
Downgrade thumbnail property from BitmapImage to subclass ImageSource
batzen/MahApps.Metro,MahApps/MahApps.Metro,pfattisc/MahApps.Metro,Evangelink/MahApps.Metro,ye4241/MahApps.Metro,xxMUROxx/MahApps.Metro
src/MahApps.Metro/MahApps.Metro.Shared/Controls/HamburgerMenu/MenuItems/HamburgerMenuImageItem.cs
src/MahApps.Metro/MahApps.Metro.Shared/Controls/HamburgerMenu/MenuItems/HamburgerMenuImageItem.cs
using System.Windows; using System.Windows.Media; namespace MahApps.Metro.Controls { /// <summary> /// The HamburgerMenuImageItem provides an image based implementation for HamburgerMenu entries. /// </summary> public class HamburgerMenuImageItem : HamburgerMenuItem { /// <summary> /// Identifies the <see cref="Thumbnail"/> dependency property. /// </summary> public static readonly DependencyProperty ThumbnailProperty = DependencyProperty.Register(nameof(Thumbnail), typeof(ImageSource), typeof(HamburgerMenuItem), new PropertyMetadata(null)); /// <summary> /// Gets or sets a value that specifies a bitmap to display with an Image control. /// </summary> public ImageSource Thumbnail { get { return (ImageSource)GetValue(ThumbnailProperty); } set { SetValue(ThumbnailProperty, value); } } protected override Freezable CreateInstanceCore() { return new HamburgerMenuImageItem(); } } }
using System.Windows; using System.Windows.Media.Imaging; namespace MahApps.Metro.Controls { /// <summary> /// The HamburgerMenuImageItem provides an image based implementation for HamburgerMenu entries. /// </summary> public class HamburgerMenuImageItem : HamburgerMenuItem { /// <summary> /// Identifies the <see cref="Thumbnail"/> dependency property. /// </summary> public static readonly DependencyProperty ThumbnailProperty = DependencyProperty.Register(nameof(Thumbnail), typeof(BitmapImage), typeof(HamburgerMenuItem), new PropertyMetadata(null)); /// <summary> /// Gets or sets a value that specifies a bitmap to display with an Image control. /// </summary> public BitmapImage Thumbnail { get { return (BitmapImage)GetValue(ThumbnailProperty); } set { SetValue(ThumbnailProperty, value); } } protected override Freezable CreateInstanceCore() { return new HamburgerMenuImageItem(); } } }
mit
C#
ed92ef24288d980928868569c891e0bd86da8196
Remove unused namespace which caused a build failure
jorbor/Kekiri,chris-peterson/Kekiri,jorbor/Kekiri
src/IoC/Autofac/AutofacFluentScenario.cs
src/IoC/Autofac/AutofacFluentScenario.cs
namespace Kekiri.IoC.Autofac { public class AutofacFluentScenario : IoCFluentScenario { public AutofacFluentScenario() : base(new AutofacContainer()) { } } public class AutofacFluentScenario<TContext> : IoCFluentScenario<TContext> where TContext : new() { public AutofacFluentScenario() : base(new AutofacContainer()) { } } }
using NUnit.Framework; namespace Kekiri.IoC.Autofac { public class AutofacFluentScenario : IoCFluentScenario { public AutofacFluentScenario() : base(new AutofacContainer()) { } } public class AutofacFluentScenario<TContext> : IoCFluentScenario<TContext> where TContext : new() { public AutofacFluentScenario() : base(new AutofacContainer()) { } } }
mit
C#
408531919b8d11f0a01a1981815e9033b50478d9
reset AssemblyInfo to something more meaningful
kenegozi/ntemplate
src/NTemplate/Properties/AssemblyInfo.cs
src/NTemplate/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("NTemplate")] [assembly: AssemblyDescription("")] [assembly: AssemblyCompany("Ken Egozi")] [assembly: AssemblyProduct("NTemplate")] [assembly: AssemblyCopyright("Copyright © Ken Egozi 2010")] [assembly: AssemblyVersion("0.9.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("NTemplate")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("NTemplate")] [assembly: AssemblyCopyright("Copyright © Microsoft 2010")] [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("e45c5805-4759-409e-9613-fd73de64b1e3")] // 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")]
bsd-3-clause
C#
aca0d06a3e132da9b9d3ed9f034bc3d42a2193bb
remove whitespace
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
src/SFA.DAS.EAS.Portal/Application/Services/AccountDocumentService.cs
src/SFA.DAS.EAS.Portal/Application/Services/AccountDocumentService.cs
using SFA.DAS.CosmosDb; using SFA.DAS.EAS.Portal.Database; using SFA.DAS.EAS.Portal.Client.Database.Models; using System.Threading; using System.Threading.Tasks; namespace SFA.DAS.EAS.Portal.Application.Services { public class AccountDocumentService : IAccountDocumentService { private readonly IAccountsRepository _accountsRepository; public AccountDocumentService(IAccountsRepository accountsRepository) { _accountsRepository = accountsRepository; } public Task<AccountDocument> Get(long id, CancellationToken cancellationToken = default) { return _accountsRepository.CreateQuery() .SingleOrDefaultAsync(a => a.AccountId == id, cancellationToken); } public async Task<AccountDocument> GetOrCreate(long id, CancellationToken cancellationToken = default) { return await Get(id, cancellationToken) ?? new AccountDocument(id); } public Task Save(AccountDocument account, CancellationToken cancellationToken = default) { if (account.IsNew) { return _accountsRepository.Add(account, null, cancellationToken); } return _accountsRepository.Update(account, null, cancellationToken); } } }
using SFA.DAS.CosmosDb; using SFA.DAS.EAS.Portal.Database; using SFA.DAS.EAS.Portal.Client.Database.Models; using System.Threading; using System.Threading.Tasks; namespace SFA.DAS.EAS.Portal.Application.Services { public class AccountDocumentService : IAccountDocumentService { private readonly IAccountsRepository _accountsRepository; public AccountDocumentService(IAccountsRepository accountsRepository) { _accountsRepository = accountsRepository; } public Task<AccountDocument> Get(long id, CancellationToken cancellationToken = default) { return _accountsRepository.CreateQuery() .SingleOrDefaultAsync(a => a.AccountId == id, cancellationToken); } public async Task<AccountDocument> GetOrCreate(long id, CancellationToken cancellationToken = default) { return await Get(id, cancellationToken) ?? new AccountDocument(id); } public Task Save(AccountDocument account, CancellationToken cancellationToken = default) { if (account.IsNew) { return _accountsRepository.Add(account, null, cancellationToken); } return _accountsRepository.Update(account, null, cancellationToken); } } }
mit
C#
5bd16f9a7ca3f8fd9f3a6fb9897d30e5d7fbc60f
Add scaling factor
NeoAdonis/osu,2yangk23/osu,smoogipoo/osu,NeoAdonis/osu,DrabWeb/osu,EVAST9919/osu,naoey/osu,ppy/osu,UselessToucan/osu,ZLima12/osu,peppy/osu,2yangk23/osu,smoogipoo/osu,ppy/osu,ZLima12/osu,peppy/osu,johnneijzen/osu,smoogipoo/osu,peppy/osu-new,NeoAdonis/osu,ppy/osu,naoey/osu,johnneijzen/osu,DrabWeb/osu,naoey/osu,smoogipooo/osu,DrabWeb/osu,UselessToucan/osu,UselessToucan/osu,EVAST9919/osu,peppy/osu
osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs
osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; using osuTK; namespace osu.Game.Rulesets.Osu.Difficulty.Skills { /// <summary> /// Represents the skill required to correctly aim at every object in the map with a uniform CircleSize and normalized distances. /// </summary> public class Aim : Skill { private const double angle_bonus_begin = 5 * Math.PI / 12; protected override double SkillMultiplier => 26.25; protected override double StrainDecayBase => 0.15; protected override double StrainValueOf(OsuDifficultyHitObject current) { double angleBonus = 0; double result = 0; if (Previous.Count > 0) { if (current.Angle != null) angleBonus = (Previous[0].JumpDistance - STREAM_SPACING_THRESHOLD) * Math.Sin(current.Angle.Value - angle_bonus_begin); result = 2 * Math.Pow(Math.Max(0, angleBonus), 0.99) / Previous[0].StrainTime; } return result + (Math.Pow(current.TravelDistance, 0.99) + Math.Pow(current.JumpDistance, 0.99)) / current.StrainTime; } } }
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; using osuTK; namespace osu.Game.Rulesets.Osu.Difficulty.Skills { /// <summary> /// Represents the skill required to correctly aim at every object in the map with a uniform CircleSize and normalized distances. /// </summary> public class Aim : Skill { private const double angle_bonus_begin = 5 * Math.PI / 12; protected override double SkillMultiplier => 26.25; protected override double StrainDecayBase => 0.15; protected override double StrainValueOf(OsuDifficultyHitObject current) { double angleBonus = 0; double result = 0; if (Previous.Count > 0) { if (current.Angle != null) angleBonus = (Previous[0].JumpDistance - STREAM_SPACING_THRESHOLD) * Math.Sin(current.Angle.Value - angle_bonus_begin); result = Math.Pow(Math.Max(0, angleBonus), 0.99) / Previous[0].StrainTime; } return result + (Math.Pow(current.TravelDistance, 0.99) + Math.Pow(current.JumpDistance, 0.99)) / current.StrainTime; } } }
mit
C#